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 2016/05/29 11:54:40 UTC

svn commit: r1745986 - in /axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl: httpclient3/ httpclient3/HTTPSenderImpl.java httpclient4/ httpclient4/HTTPSenderImpl.java

Author: veithen
Date: Sun May 29 11:54:40 2016
New Revision: 1745986

URL: http://svn.apache.org/viewvc?rev=1745986&view=rev
Log:
AXIS2-5772: Merge r1527429 to the 1.7 branch.

Modified:
    axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/   (props changed)
    axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
    axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/   (props changed)
    axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java

Propchange: axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun May 29 11:54:40 2016
@@ -0,0 +1,5 @@
+/axis/axis2/java/core/branches/1_6/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3:1295540
+/axis/axis2/java/core/branches/AXIOM-420/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3:1334386-1336397
+/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
+/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739815,1739826,1740693-1740694,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941
+/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3:1745982

Modified: axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1745986&r1=1745985&r2=1745986&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java Sun May 29 11:54:40 2016
@@ -413,28 +413,19 @@ public class HTTPSenderImpl extends HTTP
         // Process old style headers first
         Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
         String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID);
-
-        // The following only check for JSESSIONID / axis_session / custom-cookie-id from the Set-Cookie header.
-        // But it will ignore if there are other Set-Cookie values, which may cause issues at client level,
-        // when invoking via a load-balancer, which expect some specific Cookie value.
-        // So the correct fix is to add whatever the value(s) in the Set-Cookie header as session cookie.
-
-//        for (int i = 0; i < cookieHeaders.length; i++) {
-//            HeaderElement[] elements = cookieHeaders[i].getElements();
-//            for (int e = 0; e < elements.length; e++) {
-//                HeaderElement element = elements[e];
-//                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
-//                        || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-//                    sessionCookie = processCookieHeader(element);
-//                }
-//                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
-//                    sessionCookie = processCookieHeader(element);
-//                }
-//            }
-//        }
-
-        sessionCookie = processSetCookieHeaders(cookieHeaders);
-
+        for (int i = 0; i < cookieHeaders.length; i++) {
+            HeaderElement[] elements = cookieHeaders[i].getElements();
+            for (int e = 0; e < elements.length; e++) {
+                HeaderElement element = elements[e];
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                        || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+            }
+        }
         // Overwrite old style cookies with new style ones if present
         cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2);
         for (int i = 0; i < cookieHeaders.length; i++) {
@@ -451,7 +442,7 @@ public class HTTPSenderImpl extends HTTP
             }
         }
 
-        if (sessionCookie != null && !sessionCookie.equals("")) {
+        if (sessionCookie != null) {
             msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
         }
     }
@@ -465,25 +456,6 @@ public class HTTPSenderImpl extends HTTP
         }
         return cookie;
     }
-
-
-    private String processSetCookieHeaders(Header[] headers) {
-        String cookie = "";
-        for (Header header : headers) {
-            if (!cookie.equals("")) {
-                cookie = cookie + ";";
-            }
-            HeaderElement[] elements = header.getElements();
-            for (HeaderElement element : elements) {
-                cookie = cookie + element.getName() + "=" + element.getValue();
-                NameValuePair[] parameters = element.getParameters();
-                for (NameValuePair parameter : parameters) {
-                    cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
-                }
-            }
-        }
-        return cookie;
-    }
 
     protected void processResponse(HttpMethodBase httpMethod, MessageContext msgContext)
             throws IOException {

Propchange: axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun May 29 11:54:40 2016
@@ -0,0 +1,4 @@
+/axis/axis2/java/core/branches/1_6/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4:1295540
+/axis/axis2/java/core/branches/AXIOM-420/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4:1334386-1336397
+/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
+/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739815,1739826,1740693-1740694,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1745982

Modified: axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1745986&r1=1745985&r2=1745986&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Sun May 29 11:54:40 2016
@@ -433,28 +433,19 @@ public class HTTPSenderImpl extends HTTP
         // Process old style headers first
         Header[] cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE);
         String customCoookiId = (String) msgContext.getProperty(Constants.CUSTOM_COOKIE_ID);
-
-        // The following only check for JSESSIONID / axis_session / custom-cookie-id from the Set-Cookie header.
-        // But it will ignore if there are other Set-Cookie values, which may cause issues at client level,
-        // when invoking via a load-balancer, which expect some specific Cookie value.
-        // So the correct fix is to add whatever the value(s) in the Set-Cookie header as session cookie.
-
-//        for (int i = 0; i < cookieHeaders.length; i++) {
-//            HeaderElement[] elements = cookieHeaders[i].getElements();
-//            for (int e = 0; e < elements.length; e++) {
-//                HeaderElement element = elements[e];
-//                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
-//                    || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
-//                    sessionCookie = processCookieHeader(element);
-//                }
-//                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
-//                    sessionCookie = processCookieHeader(element);
-//                }
-//            }
-//        }
-
-        sessionCookie = processSetCookieHeaders(cookieHeaders);
-
+        for (int i = 0; i < cookieHeaders.length; i++) {
+            HeaderElement[] elements = cookieHeaders[i].getElements();
+            for (int e = 0; e < elements.length; e++) {
+                HeaderElement element = elements[e];
+                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName())
+                    || Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+                if (customCoookiId != null && customCoookiId.equalsIgnoreCase(element.getName())) {
+                    sessionCookie = processCookieHeader(element);
+                }
+            }
+        }
         // Overwrite old style cookies with new style ones if present
         cookieHeaders = response.getHeaders(HTTPConstants.HEADER_SET_COOKIE2);
         for (int i = 0; i < cookieHeaders.length; i++) {
@@ -471,7 +462,7 @@ public class HTTPSenderImpl extends HTTP
             }
         }
 
-        if (sessionCookie != null  && !sessionCookie.equals("")) {
+        if (sessionCookie != null) {
             msgContext.getServiceContext().setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
         }
     }
@@ -485,24 +476,6 @@ public class HTTPSenderImpl extends HTTP
         }
         return cookie;
     }
-
-    private String processSetCookieHeaders(Header[] headers) {
-        String cookie = "";
-        for (Header header : headers) {
-            if (!cookie.equals("")) {
-                cookie = cookie + ";";
-            }
-            HeaderElement[] elements = header.getElements();
-            for (HeaderElement element : elements) {
-                cookie = cookie + element.getName() + "=" + element.getValue();
-                NameValuePair[] parameters = element.getParameters();
-                for (NameValuePair parameter : parameters) {
-                    cookie = cookie + "; " + parameter.getName() + "=" + parameter.getValue();
-                }
-            }
-        }
-        return cookie;
-    }
 
     protected void processResponse(HttpResponse response, MessageContext msgContext)
             throws IOException {