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/19 20:05:35 UTC

svn commit: r1779514 - in /axis/axis2/java/core/trunk/modules: kernel/src/org/apache/axis2/transport/http/HTTPConstants.java transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/RequestImpl.java

Author: veithen
Date: Thu Jan 19 20:05:35 2017
New Revision: 1779514

URL: http://svn.apache.org/viewvc?rev=1779514&view=rev
Log:
Don't store stuff in the message context unless necessary.

Modified:
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.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/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java?rev=1779514&r1=1779513&r2=1779514&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java Thu Jan 19 20:05:35 2017
@@ -512,11 +512,6 @@ public class HTTPConstants {
     public static final String AUTO_RELEASE_CONNECTION = "AutoReleaseConnection" ;
 
     /**
-     * Cleanup response
-     */
-    public static final String CLEANUP_RESPONSE = "CleanupResponse";
-
-    /**
      * Method getBytes.
      *
      * @param data

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=1779514&r1=1779513&r2=1779514&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 Thu Jan 19 20:05:35 2017
@@ -69,6 +69,7 @@ final class RequestImpl implements Reque
     protected final HttpRequestBase method;
     protected final AbstractHttpClient httpClient;
     private final HttpHost httpHost;
+    private boolean cleanupResponse;
 
     RequestImpl(HTTPSenderImpl sender, MessageContext msgContext, final String methodName, URL url,
             AxisRequestEntity requestEntity) throws AxisFault {
@@ -181,7 +182,7 @@ final class RequestImpl implements Reque
         int statusCode = response.getStatusLine().getStatusCode();
         log.trace("Handling response - " + statusCode);
         if (statusCode == HttpStatus.SC_ACCEPTED) {
-            msgContext.setProperty(HTTPConstants.CLEANUP_RESPONSE, Boolean.TRUE);
+            cleanupResponse = true;
             /*
             * When an HTTP 202 Accepted code has been received, this will be
             * the case of an execution of an in-only operation. In such a
@@ -192,12 +193,12 @@ final class RequestImpl implements Reque
 
         } else if (statusCode >= 200 && statusCode < 300) {
             // We don't clean the response here because the response will be used afterwards
-            msgContext.setProperty(HTTPConstants.CLEANUP_RESPONSE, Boolean.FALSE);
+            cleanupResponse = false;
             sender.processResponse(response, msgContext);
 
         } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR
                    || statusCode == HttpStatus.SC_BAD_REQUEST) {
-            msgContext.setProperty(HTTPConstants.CLEANUP_RESPONSE, Boolean.TRUE);
+            cleanupResponse = true;
             Header contentTypeHeader = response.getFirstHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             String value = null;
             if (contentTypeHeader != null) {
@@ -212,7 +213,7 @@ final class RequestImpl implements Reque
                 }
             }
             if (value != null) {
-                msgContext.setProperty(HTTPConstants.CLEANUP_RESPONSE, Boolean.FALSE);
+                cleanupResponse = false;
                 sender.processResponse(response, msgContext);
             }
 
@@ -223,14 +224,14 @@ final class RequestImpl implements Reque
                                    response.getStatusLine().toString()));
             }
         } else {
-            msgContext.setProperty(HTTPConstants.CLEANUP_RESPONSE, Boolean.TRUE);
+            cleanupResponse = true;
             throw new AxisFault(Messages.getMessage("transportError", String.valueOf(statusCode),
                                                     response.getStatusLine().toString()));
         }
     }
 
     private void cleanup(HttpResponse response) {
-        if (msgContext.isPropertyTrue(HTTPConstants.CLEANUP_RESPONSE)) {
+        if (cleanupResponse) {
             log.trace("Cleaning response : " + response);
             HttpEntity entity = response.getEntity();
             if (entity != null) {