diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/HttpRequestWrapper.java b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java similarity index 89% rename from httpclient/src/main/java/org/apache/http/impl/client/execchain/HttpRequestWrapper.java rename to httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java index 38983c14a..c28ae113e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/HttpRequestWrapper.java +++ b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java @@ -25,7 +25,7 @@ * */ -package org.apache.http.impl.client.execchain; +package org.apache.http.client.methods; import java.net.URI; @@ -35,11 +35,8 @@ import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpRequest; -import org.apache.http.HttpVersion; -import org.apache.http.ProtocolException; import org.apache.http.ProtocolVersion; import org.apache.http.RequestLine; -import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.message.AbstractHttpMessage; import org.apache.http.message.BasicRequestLine; import org.apache.http.protocol.HTTP; @@ -72,7 +69,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque } public ProtocolVersion getProtocolVersion() { - return this.original.getProtocolVersion(); + return this.version != null ? this.version : this.original.getProtocolVersion(); } public void setProtocolVersion(final ProtocolVersion version) { @@ -97,8 +94,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque if (requestUri == null || requestUri.length() == 0) { requestUri = "/"; } - ProtocolVersion version = this.version != null ? this.version : HttpVersion.HTTP_1_1; - return new BasicRequestLine(this.method, requestUri, version); + return new BasicRequestLine(this.method, requestUri, getProtocolVersion()); } public HttpRequest getOriginal() { @@ -115,8 +111,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque private HttpEntity entity; - public HttpEntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request) - throws ProtocolException { + public HttpEntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request) { super(request); this.entity = request.getEntity(); } @@ -136,7 +131,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque } - public static HttpRequestWrapper wrap(final HttpRequest request) throws ProtocolException { + public static HttpRequestWrapper wrap(final HttpRequest request) { if (request == null) { return null; } diff --git a/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java index 5d51aba00..df79daa5c 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java @@ -43,6 +43,7 @@ import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.Configurable; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.params.ClientPNames; import org.apache.http.client.params.HttpClientParamConfig; import org.apache.http.client.protocol.ClientContext; @@ -58,7 +59,6 @@ import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.cookie.CookieSpecProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.execchain.ClientExecChain; -import org.apache.http.impl.client.execchain.HttpRequestWrapper; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpParams; import org.apache.http.protocol.BasicHttpContext; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/BackoffStrategyExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/BackoffStrategyExec.java index 61c36b8bf..8158aac8e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/BackoffStrategyExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/BackoffStrategyExec.java @@ -36,6 +36,7 @@ import org.apache.http.client.BackoffManager; import org.apache.http.client.ConnectionBackoffStrategy; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.routing.HttpRoute; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ClientExecChain.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ClientExecChain.java index aa91b2601..6677b3c12 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ClientExecChain.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ClientExecChain.java @@ -32,6 +32,7 @@ import java.io.IOException; import org.apache.http.HttpException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.routing.HttpRoute; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/MainClientExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/MainClientExec.java index a740588db..cbf6cf2dc 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/MainClientExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/MainClientExec.java @@ -52,6 +52,7 @@ import org.apache.http.client.UserTokenHandler; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.protocol.RequestClientConnControl; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ProtocolExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ProtocolExec.java index 56b61d05f..8e554c988 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ProtocolExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ProtocolExec.java @@ -41,6 +41,7 @@ import org.apache.http.auth.AuthState; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.params.ClientPNames; import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.protocol.HttpClientContext; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/RedirectExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/RedirectExec.java index e7d9a33d6..607dfde99 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/RedirectExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/RedirectExec.java @@ -45,6 +45,7 @@ import org.apache.http.client.RedirectStrategy; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.utils.URIUtils; import org.apache.http.conn.routing.HttpRoute; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/RetryExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/RetryExec.java index b88f45a62..f6ca1f90b 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/RetryExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/RetryExec.java @@ -38,6 +38,7 @@ import org.apache.http.client.HttpRequestRetryHandler; import org.apache.http.client.NonRepeatableRequestException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.routing.HttpRoute; diff --git a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ServiceUnavailableRetryExec.java b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ServiceUnavailableRetryExec.java index cd27f673d..fcf43664e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/execchain/ServiceUnavailableRetryExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/execchain/ServiceUnavailableRetryExec.java @@ -37,6 +37,7 @@ import org.apache.http.annotation.Immutable; import org.apache.http.client.ServiceUnavailableRetryStrategy; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpExecutionAware; +import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.routing.HttpRoute;