cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1424479 - in /cxf/trunk/rt/transports: http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Date Thu, 20 Dec 2012 14:16:02 GMT
Author: dkulp
Date: Thu Dec 20 14:16:01 2012
New Revision: 1424479

URL: http://svn.apache.org/viewvc?rev=1424479&view=rev
Log:
[CXF-4714] Better fix by fixing the underlying jetty stream

Modified:
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=1424479&r1=1424478&r2=1424479&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Dec 20 14:16:01 2012
@@ -43,6 +43,7 @@ import org.apache.cxf.configuration.jsse
 import org.apache.cxf.configuration.security.CertificateConstraintsType;
 import org.apache.cxf.continuations.ContinuationProvider;
 import org.apache.cxf.continuations.SuspendedInvocationException;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.io.CopyingOutputStream;
@@ -394,6 +395,7 @@ public class JettyHTTPDestination extend
     
     static class JettyOutputStream extends FilterOutputStream implements CopyingOutputStream
{
         final Output out;
+        boolean written;
         public JettyOutputStream(Output o) {
             super(o);
             out = o;
@@ -401,10 +403,21 @@ public class JettyHTTPDestination extend
 
         @Override
         public int copyFrom(InputStream in) throws IOException {
+            if (written) {
+                return IOUtils.copy(in, out);
+            }
             CountingInputStream c = new CountingInputStream(in);
             out.sendContent(c);
             return c.getCount();
         }
+        public void write(int b) throws IOException {
+            written = true;
+            out.write(b);
+        }
+        public void write(byte b[], int off, int len) throws IOException {
+            written = true;
+            out.write(b, off, len);
+        }
     }
     static class CountingInputStream extends FilterInputStream {
         int count;

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=1424479&r1=1424478&r2=1424479&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 14:16:01 2012
@@ -696,7 +696,7 @@ public abstract class AbstractHTTPDestin
                 written = true;
             }
             if (wrappedStream != null) {
-                return IOUtils.copy(in, wrappedStream, IOUtils.DEFAULT_BUFFER_SIZE);
+                return IOUtils.copy(in, wrappedStream);
             }
             return IOUtils.copy(in, this, IOUtils.DEFAULT_BUFFER_SIZE);
         }



Mime
View raw message