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 20:28:20 UTC
svn commit: r1779253 - in /axis/axis2/java/core/trunk/modules/transport:
http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/
http/src/org/apache/axis2/transport/http/
http/src/org/apache/axis2/transport/http/impl/httpclient4/
Author: veithen
Date: Tue Jan 17 20:28:20 2017
New Revision: 1779253
URL: http://svn.apache.org/viewvc?rev=1779253&view=rev
Log:
Clean up the mess related to how we maintain the isAllowedRetry flag. This should also fix AXIS2-4021.
Modified:
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.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/HTTPSender.java
axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.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-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java?rev=1779253&r1=1779252&r2=1779253&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/HTTPSenderImpl.java Tue Jan 17 20:28:20 2017
@@ -60,11 +60,6 @@ public class HTTPSenderImpl extends HTTP
return httpVersion;
}
- // TODO: this shouldn't be here (see AXIS2-4021)
- void setAllowedRetry(boolean isAllowedRetry) {
- this.isAllowedRetry = isAllowedRetry;
- }
-
@Override
protected Request createRequest(MessageContext msgContext, String methodName, URL url,
AxisRequestEntity requestEntity) throws AxisFault {
Modified: axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java?rev=1779253&r1=1779252&r2=1779253&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http-hc3/src/main/java/org/apache/axis2/transport/http/impl/httpclient3/RequestImpl.java Tue Jan 17 20:28:20 2017
@@ -290,9 +290,6 @@ final class RequestImpl implements Reque
int port = authenticator.getPort();
String realm = authenticator.getRealm();
- /* If retrying is available set it first */
- sender.setAllowedRetry(authenticator.isAllowedRetry());
-
Credentials creds;
HttpState tmpHttpState = null;
Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=1779253&r1=1779252&r2=1779253&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Tue Jan 17 20:28:20 2017
@@ -44,12 +44,6 @@ public abstract class AbstractHTTPSender
protected TransportOutDescription proxyOutSetting = null;
protected OMOutputFormat format = new OMOutputFormat();
- /**
- * isAllowedRetry will be using to check where the
- * retry should be allowed or not.
- */
- protected boolean isAllowedRetry = false;
-
public void setChunked(boolean chunked) {
this.chunked = 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=1779253&r1=1779252&r2=1779253&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 20:28:20 2017
@@ -46,7 +46,7 @@ public final class AxisRequestEntity {
private byte[] bytes;
- private boolean isAllowedRetry;
+ private final boolean preserve;
private OMOutputFormat format;
@@ -60,19 +60,20 @@ public final class AxisRequestEntity {
*/
AxisRequestEntity(MessageFormatter messageFormatter,
MessageContext msgContext, OMOutputFormat format, String contentType,
- boolean chunked, boolean isAllowedRetry) {
+ boolean chunked, boolean preserve) {
this.messageFormatter = messageFormatter;
this.messageContext = msgContext;
this.chunked = chunked;
- this.isAllowedRetry = isAllowedRetry;
+ this.preserve = preserve;
this.format = format;
this.contentType = contentType;
}
public boolean isRepeatable() {
- // All Axis2 request entity implementations were returning this true
- // So we return true as defualt
- return true;
+ // If chunking is disabled, we don't preserve the original SOAPEnvelope, but we store the
+ // serialized SOAPEnvelope in a byte array, which means that the entity can be written
+ // repeatedly.
+ return preserve || !chunked;
}
public void writeRequest(OutputStream outStream) throws IOException {
@@ -82,7 +83,7 @@ public final class AxisRequestEntity {
}
try {
if (chunked) {
- messageFormatter.writeTo(messageContext, format, outStream, isAllowedRetry);
+ messageFormatter.writeTo(messageContext, format, outStream, preserve);
} else {
if (bytes == null) {
bytes = messageFormatter.getBytes(messageContext, format);
Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java?rev=1779253&r1=1779252&r2=1779253&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/HTTPSender.java Tue Jan 17 20:28:20 2017
@@ -80,7 +80,19 @@ public abstract class HTTPSender extends
.getMessageFormatter(msgContext);
url = messageFormatter.getTargetAddress(msgContext, format, url);
String contentType = messageFormatter.getContentType(msgContext, format, soapActionString);
-
+
+ HTTPAuthenticator authenticator;
+ Object obj = msgContext.getProperty(HTTPConstants.AUTHENTICATE);
+ if (obj == null) {
+ authenticator = null;
+ } else {
+ if (obj instanceof HTTPAuthenticator) {
+ authenticator = (HTTPAuthenticator) obj;
+ } else {
+ throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
+ }
+ }
+
AxisRequestEntity requestEntity;
if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)
|| Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
@@ -88,7 +100,7 @@ public abstract class HTTPSender extends
} else if (Constants.Configuration.HTTP_METHOD_POST.equalsIgnoreCase(httpMethod)
|| Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
requestEntity = new AxisRequestEntity(messageFormatter, msgContext, format,
- contentType, chunked, isAllowedRetry);
+ contentType, chunked, authenticator != null && authenticator.isAllowedRetry());
} else {
throw new AxisFault("Unsupported HTTP method " + httpMethod);
}
@@ -121,13 +133,8 @@ public abstract class HTTPSender extends
// set the custom headers, if available
addCustomHeaders(msgContext, request);
- Object obj = msgContext.getProperty(HTTPConstants.AUTHENTICATE);
- if (obj != null) {
- if (obj instanceof HTTPAuthenticator) {
- request.enableAuthentication((HTTPAuthenticator) obj);
- } else {
- throw new AxisFault("HttpTransportProperties.Authenticator class cast exception");
- }
+ if (authenticator != null) {
+ request.enableAuthentication(authenticator);
}
request.execute();
Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java?rev=1779253&r1=1779252&r2=1779253&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/impl/httpclient4/HTTPSenderImpl.java Tue Jan 17 20:28:20 2017
@@ -74,11 +74,6 @@ public class HTTPSenderImpl extends HTTP
return httpVersion;
}
- // TODO: this shouldn't be here (see AXIS2-4021)
- void setAllowedRetry(boolean isAllowedRetry) {
- this.isAllowedRetry = isAllowedRetry;
- }
-
@Override
protected Request createRequest(MessageContext msgContext, String methodName, URL url,
AxisRequestEntity requestEntity) throws AxisFault {
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=1779253&r1=1779252&r2=1779253&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 20:28:20 2017
@@ -278,9 +278,6 @@ final class RequestImpl implements Reque
int port = authenticator.getPort();
String realm = authenticator.getRealm();
- /* If retrying is available set it first */
- sender.setAllowedRetry(authenticator.isAllowedRetry());
-
Credentials creds;
// TODO : Set preemptive authentication, but its not recommended in HC 4