You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/17 19:59:46 UTC

svn commit: r1779245 - in /axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http: AbstractHTTPTransportSender.java AxisRequestEntity.java impl/httpclient4/RequestImpl.java

Author: veithen
Date: Tue Jan 17 19:59:45 2017
New Revision: 1779245

URL: http://svn.apache.org/viewvc?rev=1779245&view=rev
Log:
Streamline the code that enabled HTTP chunking.

Modified:
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPTransportSender.java
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
    axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPTransportSender.java?rev=1779245&r1=1779244&r2=1779245&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPTransportSender.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPTransportSender.java Tue Jan 17 19:59:45 2017
@@ -358,14 +358,6 @@ public abstract class AbstractHTTPTransp
             // select the Message Sender depending on the REST status
             AbstractHTTPSender sender = createHTTPSender();
 
-            boolean chunked;
-            if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
-                chunked = JavaUtils.isTrueExplicitly(messageContext
-                        .getProperty(HTTPConstants.CHUNKED));
-            } else {
-                chunked = defaultChunked;
-            }
-
             String httpVersion;
             if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
                 httpVersion = (String) messageContext
@@ -373,6 +365,17 @@ public abstract class AbstractHTTPTransp
             } else {
                 httpVersion = defaultHttpVersion;
             }
+            
+            boolean chunked;
+            if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
+                chunked = false;
+            } else if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
+                chunked = JavaUtils.isTrueExplicitly(messageContext
+                        .getProperty(HTTPConstants.CHUNKED));
+            } else {
+                chunked = defaultChunked;
+            }
+
             // Following order needed to be preserved because,
             // HTTP/1.0 does not support chunk encoding
             sender.setChunked(chunked);

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java?rev=1779245&r1=1779244&r2=1779245&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java Tue Jan 17 19:59:45 2017
@@ -40,7 +40,7 @@ public final class AxisRequestEntity  {
 
     private MessageFormatter messageFormatter;
 
-    private boolean chunked = false;
+    private final boolean chunked;
 
     private MessageContext messageContext;
 
@@ -123,10 +123,6 @@ public final class AxisRequestEntity  {
         return chunked;
     }
 
-    public void setChunked(boolean chunked) {
-        this.chunked = chunked;
-    }
-
     public InputStream getRequestEntityContent() throws IOException {
         return new ByteArrayInputStream(messageFormatter.getBytes(messageContext, format));
     }

Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java?rev=1779245&r1=1779244&r2=1779245&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java Tue Jan 17 19:59:45 2017
@@ -90,9 +90,6 @@ final class RequestImpl implements Reque
                 }
             };
             entityEnclosingRequest.setEntity(new AxisRequestEntityImpl(requestEntity));
-            if (!sender.getHttpVersion().equals(HTTPConstants.HEADER_PROTOCOL_10) && sender.isChunked()) {
-                requestEntity.setChunked(sender.isChunked());
-            }
             method = entityEnclosingRequest;
         }
         sender.populateCommonProperties(msgContext, url, method, httpClient);