Author: veithen
Date: Tue Sep 28 12:19:10 2010
New Revision: 1002140
URL: http://svn.apache.org/viewvc?rev=1002140&view=rev
Log:
AXIS2-4716: Fixed a concurrency issue in CommonsHTTPTransportSender.
Modified:
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
Modified:
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=1002140&r1=1002139&r2=1002140&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
(original)
+++
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
Tue Sep 28 12:19:10 2010
@@ -66,9 +66,18 @@ public class CommonsHTTPTransportSender
private static final Log log = LogFactory
.getLog(CommonsHTTPTransportSender.class);
- protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+ /**
+ * Default HTTP version as configured in <tt>axis2.xml</tt>. This may be
overridden on a per
+ * message basis using the {...@link HTTPConstants#HTTP_PROTOCOL_VERSION}
property.
+ */
+ private String defaultHttpVersion = HTTPConstants.HEADER_PROTOCOL_11;
- private boolean chunked = false;
+ /**
+ * Specifies whether chunked encoding is enabled by default. This is
configured in
+ * <tt>axis2.xml</tt> and may be overridden on a per message basis using
the
+ * {...@link HTTPConstants#CHUNKED} property.
+ */
+ private boolean defaultChunked = false;
int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
@@ -95,7 +104,7 @@ public class CommonsHTTPTransportSender
.getParameter(HTTPConstants.PROTOCOL_VERSION);
if (version != null) {
if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
- httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+ defaultHttpVersion = HTTPConstants.HEADER_PROTOCOL_11;
Parameter transferEncoding = transportOut
.getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
@@ -103,11 +112,11 @@ public class CommonsHTTPTransportSender
if ((transferEncoding != null)
&& HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
.equals(transferEncoding.getValue())) {
- chunked = true;
+ defaultChunked = true;
}
} else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
.getValue())) {
- httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+ defaultHttpVersion = HTTPConstants.HEADER_PROTOCOL_10;
} else {
throw new AxisFault("Parameter "
+ HTTPConstants.PROTOCOL_VERSION
@@ -368,14 +377,20 @@ public class CommonsHTTPTransportSender
sender = new HTTPSender();
+ 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
.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
+ } else {
+ httpVersion = defaultHttpVersion;
}
// Following order needed to be preserved because,
// HTTP/1.0 does not support chunk encoding