本文整理汇总了Java中org.apache.http.impl.client.RequestWrapper类的典型用法代码示例。如果您正苦于以下问题:Java RequestWrapper类的具体用法?Java RequestWrapper怎么用?Java RequestWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RequestWrapper类属于org.apache.http.impl.client包,在下文中一共展示了RequestWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteRequestURI
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
protected void rewriteRequestURI(
final RequestWrapper request,
final HttpRoute route) throws ProtocolException {
try {
URI uri = request.getURI();
if (route.getProxyHost() != null && !route.isTunnelled()) {
// Make sure the request URI is absolute
if (!uri.isAbsolute()) {
HttpHost target = route.getTargetHost();
uri = URIUtils.rewriteURI(uri, target);
request.setURI(uri);
}
} else {
// Make sure the request URI is relative
if (uri.isAbsolute()) {
uri = URIUtils.rewriteURI(uri, null);
request.setURI(uri);
}
}
} catch (URISyntaxException ex) {
throw new ProtocolException("Invalid URI: " +
request.getRequestLine().getUri(), ex);
}
}
示例2: rewriteRequestURI
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
protected void rewriteRequestURI(
final RequestWrapper request,
final HttpRoute route) throws ProtocolException {
try {
URI uri = request.getURI();
if (route.getProxyHost() != null && !route.isTunnelled()) {
// Make sure the request URI is absolute
if (!uri.isAbsolute()) {
HttpHost target = route.getTargetHost();
uri = URIUtils.rewriteURI(uri, target);
request.setURI(uri);
}
} else {
// Make sure the request URI is relative
if (uri.isAbsolute()) {
uri = URIUtils.rewriteURI(uri, null);
request.setURI(uri);
}
}
} catch (URISyntaxException ex) {
throw new ProtocolException("Invalid URI: "
+ request.getRequestLine().getUri(), ex);
}
}
示例3: requestDidNotExpect100ContinueButResponseIsOne
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private void requestDidNotExpect100ContinueButResponseIsOne(
HttpRequest request, HttpResponse response)
throws ClientProtocolException {
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CONTINUE) {
return;
}
if (!requestWasWrapped(request)) {
return;
}
ProtocolVersion originalProtocol = getOriginalRequestProtocol((RequestWrapper) request);
if (originalProtocol.compareToVersion(HttpVersion.HTTP_1_1) >= 0) {
return;
}
if (originalRequestDidNotExpectContinue((RequestWrapper) request)) {
throw new ClientProtocolException(
"The incoming request did not contain a "
+ "100-continue header, but the response was a Status 100, continue.");
}
}
示例4: setHost
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
@Override
protected void setHost(HttpRequest request, String host) {
request.setHeader("Host", host);
if (request instanceof HttpRequestWrapper) {
setHost(((HttpRequestWrapper) request).getOriginal(), host);
} else if (request instanceof RequestWrapper) {
setHost(((RequestWrapper) request).getOriginal(), host);
} else {
URI oldUri = ((HttpRequestBase) request).getURI();
try {
URI newUri = replaceHost(oldUri, host);
((HttpRequestBase) request).setURI(newUri);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}
示例5: wrapRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private static RequestWrapper wrapRequest(HttpUriRequest paramHttpUriRequest)
throws IOException
{
// Byte code:
// 0: aload_0
// 1: instanceof 217
// 4: ifeq +21 -> 25
// 7: new 219 org/apache/http/impl/client/EntityEnclosingRequestWrapper
// 10: dup
// 11: aload_0
// 12: checkcast 217 org/apache/http/HttpEntityEnclosingRequest
// 15: invokespecial 222 org/apache/http/impl/client/EntityEnclosingRequestWrapper:<init> (Lorg/apache/http/HttpEntityEnclosingRequest;)V
// 18: astore_2
// 19: aload_2
// 20: invokevirtual 225 org/apache/http/impl/client/RequestWrapper:resetHeaders ()V
// 23: aload_2
// 24: areturn
// 25: new 173 org/apache/http/impl/client/RequestWrapper
// 28: dup
// 29: aload_0
// 30: invokespecial 228 org/apache/http/impl/client/RequestWrapper:<init> (Lorg/apache/http/HttpRequest;)V
// 33: astore_2
// 34: goto -15 -> 19
// 37: astore_1
// 38: new 230 org/apache/http/client/ClientProtocolException
// 41: dup
// 42: aload_1
// 43: invokespecial 233 org/apache/http/client/ClientProtocolException:<init> (Ljava/lang/Throwable;)V
// 46: athrow
// Local variable table:
// start length slot name signature
// 0 47 0 paramHttpUriRequest HttpUriRequest
// 37 6 1 localProtocolException org.apache.http.ProtocolException
// 18 16 2 localObject Object
// Exception table:
// from to target type
// 0 19 37 org/apache/http/ProtocolException
// 19 23 37 org/apache/http/ProtocolException
// 25 34 37 org/apache/http/ProtocolException
}
示例6: wrapRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private static RequestWrapper wrapRequest(HttpRequest paramHttpRequest)
throws IOException
{
// Byte code:
// 0: aload_0
// 1: instanceof 254
// 4: ifeq +21 -> 25
// 7: new 256 org/apache/http/impl/client/EntityEnclosingRequestWrapper
// 10: dup
// 11: aload_0
// 12: checkcast 254 org/apache/http/HttpEntityEnclosingRequest
// 15: invokespecial 259 org/apache/http/impl/client/EntityEnclosingRequestWrapper:<init> (Lorg/apache/http/HttpEntityEnclosingRequest;)V
// 18: astore_2
// 19: aload_2
// 20: invokevirtual 264 org/apache/http/impl/client/RequestWrapper:resetHeaders ()V
// 23: aload_2
// 24: areturn
// 25: new 261 org/apache/http/impl/client/RequestWrapper
// 28: dup
// 29: aload_0
// 30: invokespecial 267 org/apache/http/impl/client/RequestWrapper:<init> (Lorg/apache/http/HttpRequest;)V
// 33: astore_2
// 34: goto -15 -> 19
// 37: astore_1
// 38: new 269 org/apache/http/client/ClientProtocolException
// 41: dup
// 42: aload_1
// 43: invokespecial 272 org/apache/http/client/ClientProtocolException:<init> (Ljava/lang/Throwable;)V
// 46: athrow
// Local variable table:
// start length slot name signature
// 0 47 0 paramHttpRequest HttpRequest
// 37 6 1 localProtocolException org.apache.http.ProtocolException
// 18 16 2 localObject Object
// Exception table:
// from to target type
// 0 19 37 org/apache/http/ProtocolException
// 19 23 37 org/apache/http/ProtocolException
// 25 34 37 org/apache/http/ProtocolException
}
示例7: execute
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
public final <T> T execute(HttpHost paramHttpHost, HttpRequest paramHttpRequest, ResponseHandler<? extends T> paramResponseHandler)
throws IOException, ClientProtocolException
{
CookieSourceApplier localCookieSourceApplier = this.mCookieSourceApplier;
RequestWrapper localRequestWrapper = wrapRequest(paramHttpRequest);
SetCookie localSetCookie = new SetCookie(localCookieSourceApplier.this$0, paramResponseHandler, localRequestWrapper, localCookieSourceApplier.mCookieSource, (byte)0);
return localCookieSourceApplier.mClient.execute(paramHttpHost, PseudonymousCookieSource.Helper.setRequestCookie(localRequestWrapper, localCookieSourceApplier.mCookieSource), localSetCookie);
}
示例8: wrapRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private RequestWrapper wrapRequest(
final HttpRequest request) throws ProtocolException {
if (request instanceof HttpEntityEnclosingRequest) {
return new EntityEnclosingRequestWrapper(
(HttpEntityEnclosingRequest) request);
} else {
return new RequestWrapper(
request);
}
}
示例9: requestIsAborted
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
@Deprecated
protected boolean requestIsAborted(final HttpRequest request) {
if (request == null) return false;
HttpRequest req = request;
if (request instanceof RequestWrapper) { // does not forward request to
// original
req = ((RequestWrapper) request).getOriginal();
}
return (req instanceof HttpUriRequest && ((HttpUriRequest) req).isAborted());
}
示例10: wrapRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private RequestWrapper wrapRequest(
final HttpRequest request) throws ProtocolException {
if (request instanceof HttpEntityEnclosingRequest) {
return new EntityEnclosingRequestWrapper(
(HttpEntityEnclosingRequest) request);
} else {
return new RequestWrapper(
request);
}
}
示例11: getHttpUriRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private HttpUriRequest getHttpUriRequest(HttpRequest request) {
while (request instanceof RequestWrapper) {
HttpRequest original = ((RequestWrapper) request).getOriginal();
if (original == request) {
break;
}
request = original;
}
if (request instanceof HttpUriRequest) {
return (HttpUriRequest) request;
}
return null;
}
示例12: getHttpUriRequest
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private HttpUriRequest getHttpUriRequest(HttpRequest request) {
while (request instanceof RequestWrapper) {
HttpRequest original = ((RequestWrapper) request).getOriginal();
if (original == request) {
break;
}
request = original;
}
if (request instanceof HttpUriRequest) {
return (HttpUriRequest) request;
}
return null;
}
示例13: upgradeRequestTo
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private HttpRequest upgradeRequestTo(HttpRequest request,
ProtocolVersion version) throws ProtocolException {
RequestWrapper newRequest = new RequestWrapper(request);
newRequest.setProtocolVersion(version);
return newRequest;
}
示例14: downgradeRequestTo
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private HttpRequest downgradeRequestTo(HttpRequest request,
ProtocolVersion version) throws ProtocolException {
RequestWrapper newRequest = new RequestWrapper(request);
newRequest.setProtocolVersion(version);
return newRequest;
}
示例15: transferEncodingIsNotReturnedTo1_0Client
import org.apache.http.impl.client.RequestWrapper; //导入依赖的package包/类
private void transferEncodingIsNotReturnedTo1_0Client(HttpRequest request,
HttpResponse response) {
if (!requestWasWrapped(request)) {
return;
}
ProtocolVersion originalProtocol = getOriginalRequestProtocol((RequestWrapper) request);
if (originalProtocol.compareToVersion(HttpVersion.HTTP_1_1) >= 0) {
return;
}
removeResponseTransferEncoding(response);
}