cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1424431 - in /cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/http/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Thu, 20 Dec 2012 12:25:48 GMT
Author: sergeyb
Date: Thu Dec 20 12:25:47 2012
New Revision: 1424431

URL: http://svn.apache.org/viewvc?rev=1424431&view=rev
Log:
[CXF-4741] Minor fix to prevent HTTP CopyingOutputStream impl from looping

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1424431&r1=1424430&r2=1424431&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Dec 20 12:25:47 2012
@@ -696,7 +696,7 @@ public abstract class AbstractHTTPDestin
                 written = true;
             }
             if (wrappedStream != null) {
-                return IOUtils.copy(in, wrappedStream);
+                return IOUtils.copy(in, wrappedStream, IOUtils.DEFAULT_BUFFER_SIZE);
             }
             return IOUtils.copy(in, this, IOUtils.DEFAULT_BUFFER_SIZE);
         }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1424431&r1=1424430&r2=1424431&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Thu Dec 20 12:25:47 2012
@@ -105,6 +105,27 @@ public class JAXRSMultipartTest extends 
     }
     
     @Test
+    public void testGetBookAsStringContent() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/content/string";
+        doTestGetBookAsPlainContent(address);
+    }
+    
+    @Test
+    public void testGetBookAsByteContent() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/content/bytes";
+        doTestGetBookAsPlainContent(address);
+    }
+    
+    private void doTestGetBookAsPlainContent(String address) throws Exception {
+        WebClient wc = WebClient.create(address);
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000);
+        wc.accept("multipart/mixed");
+        MultipartBody book = wc.get(MultipartBody.class);
+        Book b = book.getRootAttachment().getObject(Book.class);
+        assertEquals(888L, b.getId());
+    }
+    
+    @Test
     public void testBookAsMessageContextDataHandler() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/books/mchandlers";
         doAddBook(address, "attachmentData", 200);               
@@ -421,7 +442,6 @@ public class JAXRSMultipartTest extends 
     
     private void doTestNullPart(String address) throws Exception {
         WebClient client = WebClient.create(address);
-        WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
         client.type("multipart/form-data").accept("text/plain");
         List<Attachment> atts = new LinkedList<Attachment>();
         atts.add(new Attachment("somepart", "text/plain", "hello there"));

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1424431&r1=1424430&r2=1424431&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Thu Dec 20 12:25:47 2012
@@ -63,6 +63,27 @@ public class MultipartStore {
     public MultipartStore() {
     }
     
+    @GET
+    @Path("/content/string")
+    @Produces("multipart/mixed")
+    public Attachment getAttachmentWithStringContent() throws Exception {
+        Attachment respXMLPayloadAttachment = new Attachment("Response_XML_Payload", 
+                                                             "application/xml",
+                                                             "<Book><id>888</id></Book>");
+        return respXMLPayloadAttachment;
+    }
+    
+    @GET
+    @Path("/content/bytes")
+    @Produces("multipart/mixed")
+    public Attachment getAttachmentWithByteContent() throws Exception {
+        Attachment respXMLPayloadAttachment = new Attachment("Response_XML_Payload", 
+                                                             "application/xml",
+                                                             "<Book><id>888</id></Book>".getBytes());
+        return respXMLPayloadAttachment;
+    }
+    
+    
     @POST
     @Path("/books/image")
     @Consumes("multipart/mixed")



Mime
View raw message