cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r551429 - /incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Date Thu, 28 Jun 2007 02:33:12 GMT
Author: dkulp
Date: Wed Jun 27 19:33:11 2007
New Revision: 551429

URL: http://svn.apache.org/viewvc?view=rev&rev=551429
Log:
if chunking, don't pass the flush through until close or extra "tiny" chunks are created.

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=551429&r1=551428&r2=551429
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Jun 27 19:33:11 2007
@@ -494,6 +494,8 @@
         } else {
             connection.setRequestMethod("POST");
         }
+        
+        boolean isChunking = false;
         // We must cache the request if we have basic auth supplier
         // without preemptive basic auth.
         if (basicAuthSupplier != null) {
@@ -519,6 +521,7 @@
                 // documented client constant.
                 //use -1 and allow the URL connection to pick a default value
                 connection.setChunkedStreamingMode(-1);
+                isChunking = true;
             }
         }
         
@@ -546,7 +549,8 @@
         
         message.setContent(OutputStream.class,
                 new WrappedOutputStream(
-                        message, connection, needToCacheRequest));
+                        message, connection,
+                        needToCacheRequest, isChunking));
         
         // We are now "ready" to "send" the message. 
     }
@@ -1652,6 +1656,12 @@
         private boolean cachingForRetransmision;
         
         /**
+         * If we are going to be chunking, we won't flush till close which causes
+         * new chunks, small network packets, etc..
+         */
+        private final boolean chunking;
+        
+        /**
          * This field contains the output stream with which we cache
          * the request. It maybe null if we are not caching.
          */
@@ -1662,12 +1672,14 @@
         WrappedOutputStream(
                 Message m, 
                 HttpURLConnection c, 
-                boolean possibleRetransmit
+                boolean possibleRetransmit,
+                boolean isChunking
         ) {
             super();
             this.outMessage = m;
             connection = c;
             cachingForRetransmision = possibleRetransmit;
+            chunking = isChunking;
         }
 
         /**
@@ -1712,6 +1724,12 @@
             }
         }
 
+        public void flush() throws IOException {
+            if (!chunking) {
+                super.flush();
+            }
+        }
+        
         /**
          * Perform any actions required on stream closure (handle response etc.)
          */
@@ -1719,6 +1737,7 @@
             if (!written) {
                 handleHeadersTrustCaching();
             }
+            super.flush();
             super.close();
             handleResponse();
         }



Mime
View raw message