Author: sagara Date: Mon May 21 12:14:14 2012 New Revision: 1340985 URL: http://svn.apache.org/viewvc?rev=1340985&view=rev Log: Applied latest patch.
Modified: axis/axis2/java/core/branches/AXIS2-4318/ (props changed) axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Propchange: axis/axis2/java/core/branches/AXIS2-4318/ ------------------------------------------------------------------------------ Merged /axis/axis2/java/core/trunk:r1324778 Modified: axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1340985&r1=1340984&r2=1340985&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Mon May 21 12:14:14 2012 @@ -58,6 +58,8 @@ import org.apache.http.client.methods.Ht import org.apache.http.client.params.AuthPolicy; import org.apache.http.client.params.ClientPNames; import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.params.ConnManagerPNames; +import org.apache.http.conn.params.ConnPerRouteBean; import org.apache.http.conn.scheme.PlainSocketFactory; import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; @@ -318,21 +320,21 @@ public class HTTPSenderImpl extends HTTP int statusCode = response.getStatusLine().getStatusCode(); HTTPStatusCodeFamily family = getHTTPStatusCodeFamily(statusCode); log.trace("Handling response - " + statusCode); - if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) { + if (statusCode == HttpStatus.SC_ACCEPTED) { + /* + * 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 + * scenario, the HTTP response headers should be returned, i.e. + * session cookies. + */ + obtainHTTPHeaderInformation(response, msgContext); + + } else if (HTTPStatusCodeFamily.SUCCESSFUL.equals(family)) { // Save the HttpMethod so that we can release the connection when // cleaning up // TODO : Do we need to save the http method // msgContext.setProperty(HTTPConstants.HTTP_METHOD, method); - processResponse(response, msgContext); - } else if (statusCode == HttpStatus.SC_ACCEPTED) { - /* - * 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 - * scenario, the HTTP response headers should be returned, i.e. - * session cookies. - */ - obtainHTTPHeaderInformation(response.getEntity(), msgContext); } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR || statusCode == HttpStatus.SC_BAD_REQUEST) { @@ -813,7 +815,11 @@ public class HTTPSenderImpl extends HTTP schemeRegistry.register( new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); - connManager = new ThreadSafeClientConnManager(new BasicHttpParams(), + HttpParams params = new BasicHttpParams(); + params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30); + params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, + new ConnPerRouteBean(30)); + connManager = new ThreadSafeClientConnManager(params, schemeRegistry); configContext.setProperty( HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, connManager); @@ -824,7 +830,9 @@ public class HTTPSenderImpl extends HTTP * Create a new instance of HttpClient since the way it is used here * it's not fully thread-safe. */ - httpClient = new DefaultHttpClient(connManager, null); + HttpParams clientParams = new BasicHttpParams(); + clientParams.setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET, "UTF-8"); + httpClient = new DefaultHttpClient(connManager, clientParams); //We don't need to set timeout for connection manager, since we are doing it below // and its enough