cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1089409 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/
Date Wed, 06 Apr 2011 11:46:42 GMT
Author: sergeyb
Date: Wed Apr  6 11:46:41 2011
New Revision: 1089409

URL: http://svn.apache.org/viewvc?rev=1089409&view=rev
Log:
Merged revisions 1089407 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1089407 | sergeyb | 2011-04-06 12:42:41 +0100 (Wed, 06 Apr 2011) | 1 line
  
  [JAX-RS] Verifying multipart/form-data requests with a single file can be handled, minor
update to simplify the retrieval of multipart/form-data parts
........

Added:
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormJsonFile
      - copied unchanged from r1089407, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/attachmentFormJsonFile
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/MultipartBody.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1089407

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/MultipartBody.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/MultipartBody.java?rev=1089409&r1=1089408&r2=1089409&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/MultipartBody.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/MultipartBody.java
Wed Apr  6 11:46:41 2011
@@ -85,6 +85,10 @@ public class MultipartBody {
             if (contentId.equalsIgnoreCase(a.getContentId())) {
                 return a;
             }
+            ContentDisposition cd = a.getContentDisposition();
+            if (cd != null && contentId.equals(cd.getParameter("name"))) {
+                return a;
+            }
         }
         return null;
     }

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1089409&r1=1089408&r2=1089409&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Wed Apr  6 11:46:41 2011
@@ -123,12 +123,18 @@ public class JAXRSMultipartTest extends 
     }
     
     @Test
-    public void testBookJSONFormFiles() throws Exception {
+    public void testBookJSONFormTwoFiles() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/filesform";
         doAddFormBook(address, "attachmentFormJsonFiles", 200);               
     }
     
     @Test
+    public void testBookJSONFormOneFile() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/books/fileform";
+        doAddFormBook(address, "attachmentFormJsonFile", 200);               
+    }
+    
+    @Test
     public void testBookAsMessageContextAttachment() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/attachment";
         doAddBook(address, "attachmentData", 200);               

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1089409&r1=1089408&r2=1089409&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Wed Apr  6 11:46:41 2011
@@ -379,6 +379,23 @@ public class MultipartStore {
     }
     
     @POST
+    @Path("/books/fileform")
+    @Produces("text/xml")
+    @Consumes("multipart/form-data")
+    public Response addBookFilesForm(MultipartBody body) 
+        throws Exception {
+        String owner = body.getAttachmentObject("owner", String.class);
+        Book book = body.getAttachmentObject("file", Book.class);
+        if (!"CXF in Action - 1".equals(book.getName())
+            || !"Larry".equals(owner)) {
+            throw new WebApplicationException();
+        }
+        book.setId(124);
+        book.setName("CXF in Action - 2");
+        return Response.ok(book).build();
+    }
+    
+    @POST
     @Path("/books/jaxbform")
     @Produces("text/xml")
     @Consumes("multipart/form-data")



Mime
View raw message