Moved HttpRequestWrapper to public API package

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1416586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-12-03 16:49:37 +00:00
parent 0edf06281f
commit a901dbf14f
9 changed files with 13 additions and 11 deletions

View File

@ -25,7 +25,7 @@
* *
*/ */
package org.apache.http.impl.client.execchain; package org.apache.http.client.methods;
import java.net.URI; import java.net.URI;
@ -35,11 +35,8 @@ import org.apache.http.Header;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest; import org.apache.http.HttpRequest;
import org.apache.http.HttpVersion;
import org.apache.http.ProtocolException;
import org.apache.http.ProtocolVersion; import org.apache.http.ProtocolVersion;
import org.apache.http.RequestLine; import org.apache.http.RequestLine;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.AbstractHttpMessage; import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.message.BasicRequestLine; import org.apache.http.message.BasicRequestLine;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
@ -72,7 +69,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque
} }
public ProtocolVersion getProtocolVersion() { public ProtocolVersion getProtocolVersion() {
return this.original.getProtocolVersion(); return this.version != null ? this.version : this.original.getProtocolVersion();
} }
public void setProtocolVersion(final ProtocolVersion version) { public void setProtocolVersion(final ProtocolVersion version) {
@ -97,8 +94,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque
if (requestUri == null || requestUri.length() == 0) { if (requestUri == null || requestUri.length() == 0) {
requestUri = "/"; requestUri = "/";
} }
ProtocolVersion version = this.version != null ? this.version : HttpVersion.HTTP_1_1; return new BasicRequestLine(this.method, requestUri, getProtocolVersion());
return new BasicRequestLine(this.method, requestUri, version);
} }
public HttpRequest getOriginal() { public HttpRequest getOriginal() {
@ -115,8 +111,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpReque
private HttpEntity entity; private HttpEntity entity;
public HttpEntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request) public HttpEntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request) {
throws ProtocolException {
super(request); super(request);
this.entity = request.getEntity(); 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) { if (request == null) {
return null; return null;
} }

View File

@ -43,6 +43,7 @@ import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.Configurable; import org.apache.http.client.methods.Configurable;
import org.apache.http.client.methods.HttpExecutionAware; 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.ClientPNames;
import org.apache.http.client.params.HttpClientParamConfig; import org.apache.http.client.params.HttpClientParamConfig;
import org.apache.http.client.protocol.ClientContext; 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.cookie.CookieSpecProvider;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.execchain.ClientExecChain; 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.BasicHttpParams;
import org.apache.http.params.HttpParams; import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.BasicHttpContext;

View File

@ -36,6 +36,7 @@ import org.apache.http.client.BackoffManager;
import org.apache.http.client.ConnectionBackoffStrategy; import org.apache.http.client.ConnectionBackoffStrategy;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.protocol.HttpClientContext;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;

View File

@ -32,6 +32,7 @@ import java.io.IOException;
import org.apache.http.HttpException; import org.apache.http.HttpException;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.protocol.HttpClientContext;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;

View File

@ -52,6 +52,7 @@ import org.apache.http.client.UserTokenHandler;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.ClientContext;
import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.protocol.RequestClientConnControl; import org.apache.http.client.protocol.RequestClientConnControl;

View File

@ -41,6 +41,7 @@ import org.apache.http.auth.AuthState;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.ClientPNames;
import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.protocol.ClientContext;
import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.client.protocol.HttpClientContext;

View File

@ -45,6 +45,7 @@ import org.apache.http.client.RedirectStrategy;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.protocol.HttpClientContext;
import org.apache.http.client.utils.URIUtils; import org.apache.http.client.utils.URIUtils;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;

View File

@ -38,6 +38,7 @@ import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.NonRepeatableRequestException; import org.apache.http.client.NonRepeatableRequestException;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.protocol.HttpClientContext;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;

View File

@ -37,6 +37,7 @@ import org.apache.http.annotation.Immutable;
import org.apache.http.client.ServiceUnavailableRetryStrategy; import org.apache.http.client.ServiceUnavailableRetryStrategy;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpExecutionAware; 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.protocol.HttpClientContext;
import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoute;