adapted to HTTPCORE-100
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@558119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4862a917b
commit
fd53851031
|
@ -31,10 +31,12 @@
|
|||
|
||||
package org.apache.http.client.protocol;
|
||||
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
|
||||
public class HttpClientContext extends HttpExecutionContext {
|
||||
/**
|
||||
* {@link org.apache.http.protocol.HttpContext Context}
|
||||
* attribute names for client.
|
||||
*/
|
||||
public interface ClientContext {
|
||||
|
||||
public static final String COOKIESPEC_REGISTRY = "http.cookiespec-registry";
|
||||
public static final String AUTHSCHEME_REGISTRY = "http.authscheme-registry";
|
||||
|
@ -43,9 +45,4 @@ public class HttpClientContext extends HttpExecutionContext {
|
|||
public static final String COOKIE_ORIGIN = "http.cookie-origin";
|
||||
public static final String TARGET_AUTH_STATE = "http.auth.target-scope";
|
||||
public static final String PROXY_AUTH_STATE = "http.auth.proxy-scope";
|
||||
|
||||
public HttpClientContext(final HttpContext parentContext) {
|
||||
super(parentContext);
|
||||
}
|
||||
|
||||
}
|
|
@ -54,7 +54,7 @@ import org.apache.http.cookie.CookieOrigin;
|
|||
import org.apache.http.cookie.CookieSpec;
|
||||
import org.apache.http.cookie.CookieSpecRegistry;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
||||
/**
|
||||
* Request interceptor that matches cookies available in the current
|
||||
|
@ -86,7 +86,7 @@ public class RequestAddCookies implements HttpRequestInterceptor {
|
|||
|
||||
// Obtain HTTP state
|
||||
HttpState state = (HttpState) context.getAttribute(
|
||||
HttpClientContext.HTTP_STATE);
|
||||
ClientContext.HTTP_STATE);
|
||||
if (state == null) {
|
||||
LOG.info("HTTP state not available in HTTP context");
|
||||
return;
|
||||
|
@ -94,7 +94,7 @@ public class RequestAddCookies implements HttpRequestInterceptor {
|
|||
|
||||
// Obtain the registry of cookie specs
|
||||
CookieSpecRegistry registry= (CookieSpecRegistry) context.getAttribute(
|
||||
HttpClientContext.COOKIESPEC_REGISTRY);
|
||||
ClientContext.COOKIESPEC_REGISTRY);
|
||||
if (registry == null) {
|
||||
LOG.info("CookieSpec registry not available in HTTP context");
|
||||
return;
|
||||
|
@ -102,14 +102,14 @@ public class RequestAddCookies implements HttpRequestInterceptor {
|
|||
|
||||
// Obtain the target host (required)
|
||||
HttpHost targetHost = (HttpHost) context.getAttribute(
|
||||
HttpExecutionContext.HTTP_TARGET_HOST);
|
||||
ExecutionContext.HTTP_TARGET_HOST);
|
||||
if (targetHost == null) {
|
||||
throw new IllegalStateException("Target host not specified in HTTP context");
|
||||
}
|
||||
|
||||
// Obtain the client connection (required)
|
||||
ManagedClientConnection conn = (ManagedClientConnection) context.getAttribute(
|
||||
HttpExecutionContext.HTTP_CONNECTION);
|
||||
ExecutionContext.HTTP_CONNECTION);
|
||||
if (conn == null) {
|
||||
throw new IllegalStateException("Client connection not specified in HTTP context");
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ public class RequestAddCookies implements HttpRequestInterceptor {
|
|||
|
||||
// Stick the CookieSpec and CookieOrigin instances to the HTTP context
|
||||
// so they could be obtained by the response interceptor
|
||||
context.setAttribute(HttpClientContext.COOKIE_SPEC, cookieSpec);
|
||||
context.setAttribute(HttpClientContext.COOKIE_ORIGIN, cookieOrigin);
|
||||
context.setAttribute(ClientContext.COOKIE_SPEC, cookieSpec);
|
||||
context.setAttribute(ClientContext.COOKIE_ORIGIN, cookieOrigin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RequestProxyAuthentication implements HttpRequestInterceptor {
|
|||
|
||||
// Obtain authentication state
|
||||
AuthState authState = (AuthState) context.getAttribute(
|
||||
HttpClientContext.PROXY_AUTH_STATE);
|
||||
ClientContext.PROXY_AUTH_STATE);
|
||||
if (authState == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RequestTargetAuthentication implements HttpRequestInterceptor {
|
|||
|
||||
// Obtain authentication state
|
||||
AuthState authState = (AuthState) context.getAttribute(
|
||||
HttpClientContext.TARGET_AUTH_STATE);
|
||||
ClientContext.TARGET_AUTH_STATE);
|
||||
if (authState == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -76,21 +76,21 @@ public class ResponseProcessCookies implements HttpResponseInterceptor {
|
|||
|
||||
// Obtain HTTP state
|
||||
HttpState state = (HttpState) context.getAttribute(
|
||||
HttpClientContext.HTTP_STATE);
|
||||
ClientContext.HTTP_STATE);
|
||||
if (state == null) {
|
||||
LOG.info("HTTP state not available in HTTP context");
|
||||
return;
|
||||
}
|
||||
// Obtain actual CookieSpec instance
|
||||
CookieSpec cookieSpec = (CookieSpec) context.getAttribute(
|
||||
HttpClientContext.COOKIE_SPEC);
|
||||
ClientContext.COOKIE_SPEC);
|
||||
if (cookieSpec == null) {
|
||||
LOG.info("CookieSpec not available in HTTP context");
|
||||
return;
|
||||
}
|
||||
// Obtain actual CookieOrigin instance
|
||||
CookieOrigin cookieOrigin = (CookieOrigin) context.getAttribute(
|
||||
HttpClientContext.COOKIE_ORIGIN);
|
||||
ClientContext.COOKIE_ORIGIN);
|
||||
if (cookieOrigin == null) {
|
||||
LOG.info("CookieOrigin not available in HTTP context");
|
||||
return;
|
||||
|
|
|
@ -51,12 +51,12 @@ import org.apache.http.client.HttpState;
|
|||
import org.apache.http.client.RedirectHandler;
|
||||
import org.apache.http.client.RoutedRequest;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.cookie.CookieSpecRegistry;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.BasicHttpProcessor;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.BasicHttpContext;
|
||||
import org.apache.http.protocol.HttpRequestInterceptorList;
|
||||
import org.apache.http.protocol.HttpResponseInterceptorList;
|
||||
|
||||
|
@ -418,7 +418,7 @@ public abstract class AbstractHttpClient
|
|||
|
||||
synchronized (this) {
|
||||
if (context == null) {
|
||||
context = new HttpClientContext(getDefaultContext());
|
||||
context = new BasicHttpContext(getDefaultContext());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ public abstract class AbstractHttpClient
|
|||
// all shared objects that are potentially threading unsafe.
|
||||
synchronized (this) {
|
||||
if (context == null) {
|
||||
context = new HttpClientContext(getDefaultContext());
|
||||
context = new BasicHttpContext(getDefaultContext());
|
||||
}
|
||||
// Create a director for this request
|
||||
director = new DefaultClientRequestDirector(
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.http.auth.AuthenticationException;
|
|||
import org.apache.http.auth.MalformedChallengeException;
|
||||
import org.apache.http.client.AuthenticationHandler;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.message.BufferedHeader;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
@ -153,7 +153,7 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler {
|
|||
final HttpContext context) throws AuthenticationException {
|
||||
|
||||
AuthSchemeRegistry registry = (AuthSchemeRegistry) context.getAttribute(
|
||||
HttpClientContext.AUTHSCHEME_REGISTRY);
|
||||
ClientContext.AUTHSCHEME_REGISTRY);
|
||||
if (registry == null) {
|
||||
throw new IllegalStateException("AuthScheme registry not set in HTTP context");
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ import org.apache.http.client.RoutedRequest;
|
|||
import org.apache.http.client.methods.AbortableHttpRequest;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.conn.BasicManagedEntity;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.ConnectionPoolTimeoutException;
|
||||
|
@ -83,7 +83,7 @@ import org.apache.http.params.HttpParamsLinker;
|
|||
import org.apache.http.params.HttpProtocolParams;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
import org.apache.http.protocol.HttpProcessor;
|
||||
import org.apache.http.protocol.HttpRequestExecutor;
|
||||
import org.apache.http.util.CharArrayBuffer;
|
||||
|
@ -323,15 +323,15 @@ public class DefaultClientRequestDirector
|
|||
HttpHost proxy = route.getProxyHost();
|
||||
|
||||
// Populate the execution context
|
||||
context.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST,
|
||||
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST,
|
||||
target);
|
||||
context.setAttribute(HttpExecutionContext.HTTP_PROXY_HOST,
|
||||
context.setAttribute(ExecutionContext.HTTP_PROXY_HOST,
|
||||
proxy);
|
||||
context.setAttribute(HttpExecutionContext.HTTP_CONNECTION,
|
||||
context.setAttribute(ExecutionContext.HTTP_CONNECTION,
|
||||
managedConn);
|
||||
context.setAttribute(HttpClientContext.TARGET_AUTH_STATE,
|
||||
context.setAttribute(ClientContext.TARGET_AUTH_STATE,
|
||||
targetAuthState);
|
||||
context.setAttribute(HttpClientContext.PROXY_AUTH_STATE,
|
||||
context.setAttribute(ClientContext.PROXY_AUTH_STATE,
|
||||
proxyAuthState);
|
||||
requestExec.preProcess(request, httpProcessor, context);
|
||||
|
||||
|
@ -339,7 +339,7 @@ public class DefaultClientRequestDirector
|
|||
((AbortableHttpRequest) orig).setReleaseTrigger(managedConn);
|
||||
}
|
||||
|
||||
context.setAttribute(HttpExecutionContext.HTTP_REQUEST,
|
||||
context.setAttribute(ExecutionContext.HTTP_REQUEST,
|
||||
request);
|
||||
|
||||
execCount++;
|
||||
|
@ -580,7 +580,8 @@ public class DefaultClientRequestDirector
|
|||
response.getStatusLine());
|
||||
}
|
||||
|
||||
HttpState state = (HttpState) context.getAttribute(HttpClientContext.HTTP_STATE);
|
||||
HttpState state = (HttpState)
|
||||
context.getAttribute(ClientContext.HTTP_STATE);
|
||||
|
||||
if (state != null && HttpClientParams.isAuthenticating(params)) {
|
||||
if (this.authHandler.isProxyAuthenticationRequested(response, context)) {
|
||||
|
@ -757,13 +758,15 @@ public class DefaultClientRequestDirector
|
|||
return new RoutedRequest.Impl(redirect, newRoute);
|
||||
}
|
||||
|
||||
HttpState state = (HttpState) context.getAttribute(HttpClientContext.HTTP_STATE);
|
||||
HttpState state = (HttpState)
|
||||
context.getAttribute(ClientContext.HTTP_STATE);
|
||||
|
||||
if (state != null && HttpClientParams.isAuthenticating(params)) {
|
||||
|
||||
if (this.authHandler.isTargetAuthenticationRequested(response, context)) {
|
||||
|
||||
target = (HttpHost) context.getAttribute(HttpExecutionContext.HTTP_TARGET_HOST);
|
||||
target = (HttpHost)
|
||||
context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
|
||||
if (target == null) {
|
||||
target = route.getTargetHost();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.apache.http.client.VersionInfo;
|
|||
import org.apache.http.client.params.AuthPolicy;
|
||||
import org.apache.http.client.params.CookiePolicy;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.client.protocol.RequestAddCookies;
|
||||
import org.apache.http.client.protocol.RequestProxyAuthentication;
|
||||
import org.apache.http.client.protocol.RequestTargetAuthentication;
|
||||
|
@ -77,7 +77,7 @@ import org.apache.http.protocol.RequestContent;
|
|||
import org.apache.http.protocol.RequestExpectContinue;
|
||||
import org.apache.http.protocol.RequestTargetHost;
|
||||
import org.apache.http.protocol.RequestUserAgent;
|
||||
import org.apache.http.protocol.SyncHttpExecutionContext;
|
||||
import org.apache.http.protocol.SyncBasicHttpContext;
|
||||
|
||||
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class DefaultHttpClient extends AbstractHttpClient {
|
|||
|
||||
|
||||
protected HttpContext createHttpContext() {
|
||||
return new SyncHttpExecutionContext(null);
|
||||
return new SyncBasicHttpContext(null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,13 +245,13 @@ public class DefaultHttpClient extends AbstractHttpClient {
|
|||
|
||||
protected void populateContext(final HttpContext context) {
|
||||
context.setAttribute(
|
||||
HttpClientContext.AUTHSCHEME_REGISTRY,
|
||||
ClientContext.AUTHSCHEME_REGISTRY,
|
||||
getAuthSchemes());
|
||||
context.setAttribute(
|
||||
HttpClientContext.COOKIESPEC_REGISTRY,
|
||||
ClientContext.COOKIESPEC_REGISTRY,
|
||||
getCookieSpecs());
|
||||
context.setAttribute(
|
||||
HttpClientContext.HTTP_STATE,
|
||||
ClientContext.HTTP_STATE,
|
||||
getState());
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import javax.net.ssl.SSLHandshakeException;
|
|||
import org.apache.http.NoHttpResponseException;
|
||||
import org.apache.http.client.HttpRequestRetryHandler;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
||||
/**
|
||||
* The default {@link HttpRequestRetryHandler} used by request executors.
|
||||
|
@ -105,7 +105,8 @@ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
|
|||
// SSL handshake exception
|
||||
return false;
|
||||
}
|
||||
Boolean b = (Boolean) context.getAttribute(HttpExecutionContext.HTTP_REQ_SENT);
|
||||
Boolean b = (Boolean)
|
||||
context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
|
||||
boolean sent = (b != null && b.booleanValue());
|
||||
if (!sent || this.requestSentRetryEnabled) {
|
||||
// Retry if the request has not been sent fully or
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.apache.http.client.RedirectHandler;
|
|||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
||||
/**
|
||||
* Default implementation of a redirect handler.
|
||||
|
@ -124,7 +124,7 @@ public class DefaultRedirectHandler implements RedirectHandler {
|
|||
}
|
||||
// Adjust location URI
|
||||
HttpHost target = (HttpHost) context.getAttribute(
|
||||
HttpExecutionContext.HTTP_TARGET_HOST);
|
||||
ExecutionContext.HTTP_TARGET_HOST);
|
||||
if (target == null) {
|
||||
throw new IllegalStateException("Target host not available " +
|
||||
"in the HTTP context");
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.http.conn.ClientConnectionManager;
|
|||
import org.apache.http.conn.HttpRoute;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
import org.apache.http.protocol.HttpProcessor;
|
||||
import org.apache.http.protocol.HttpRequestExecutor;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
@ -96,12 +96,12 @@ public class ExecReqThread extends GetConnThread {
|
|||
|
||||
try {
|
||||
request_spec.context.setAttribute
|
||||
(HttpExecutionContext.HTTP_CONNECTION, connection);
|
||||
(ExecutionContext.HTTP_CONNECTION, connection);
|
||||
|
||||
doOpenConnection();
|
||||
|
||||
HttpRequest request = (HttpRequest) request_spec.context.
|
||||
getAttribute(HttpExecutionContext.HTTP_REQUEST);
|
||||
getAttribute(ExecutionContext.HTTP_REQUEST);
|
||||
request_spec.executor.preProcess
|
||||
(request, request_spec.processor, request_spec.context);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.http.HttpResponse;
|
|||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.params.HttpParamsLinker;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
import org.apache.http.protocol.HttpProcessor;
|
||||
import org.apache.http.protocol.HttpRequestExecutor;
|
||||
|
||||
|
@ -65,9 +65,9 @@ public final class Helper {
|
|||
HttpContext ctxt)
|
||||
throws Exception {
|
||||
|
||||
ctxt.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
|
||||
ctxt.setAttribute(HttpExecutionContext.HTTP_TARGET_HOST, target);
|
||||
ctxt.setAttribute(HttpExecutionContext.HTTP_REQUEST, req);
|
||||
ctxt.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
|
||||
ctxt.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
|
||||
ctxt.setAttribute(ExecutionContext.HTTP_REQUEST, req);
|
||||
|
||||
HttpParamsLinker.link(req, params);
|
||||
exec.preProcess(req, proc, ctxt);
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.http.entity.StringEntity;
|
|||
import org.apache.http.localserver.LocalTestServer;
|
||||
import org.apache.http.localserver.ServerTestBase;
|
||||
import org.apache.http.params.HttpParamsLinker;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
|
||||
|
@ -81,11 +81,11 @@ public class TestLocalServer extends ServerTestBase {
|
|||
HttpClientConnection conn = connectTo(target);
|
||||
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_CONNECTION, conn);
|
||||
ExecutionContext.HTTP_CONNECTION, conn);
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_TARGET_HOST, target);
|
||||
ExecutionContext.HTTP_TARGET_HOST, target);
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_REQUEST, request);
|
||||
ExecutionContext.HTTP_REQUEST, request);
|
||||
|
||||
HttpParamsLinker.link(request, defaultParams);
|
||||
httpExecutor.preProcess
|
||||
|
@ -124,11 +124,11 @@ public class TestLocalServer extends ServerTestBase {
|
|||
HttpClientConnection conn = connectTo(target);
|
||||
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_CONNECTION, conn);
|
||||
ExecutionContext.HTTP_CONNECTION, conn);
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_TARGET_HOST, target);
|
||||
ExecutionContext.HTTP_TARGET_HOST, target);
|
||||
httpContext.setAttribute(
|
||||
HttpExecutionContext.HTTP_REQUEST, request);
|
||||
ExecutionContext.HTTP_REQUEST, request);
|
||||
|
||||
HttpParamsLinker.link(request, defaultParams);
|
||||
httpExecutor.preProcess
|
||||
|
|
|
@ -49,7 +49,8 @@ import org.apache.http.conn.params.HttpConnectionManagerParams;
|
|||
import org.apache.http.localserver.ServerTestBase;
|
||||
import org.apache.http.message.BasicHttpRequest;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.BasicHttpContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
|
||||
|
@ -138,13 +139,13 @@ public class TestTSCCMWithServer extends ServerTestBase {
|
|||
ExecReqThread.RequestSpec ertrs = new ExecReqThread.RequestSpec();
|
||||
ertrs.executor = httpExecutor;
|
||||
ertrs.processor = httpProcessor;
|
||||
ertrs.context = new HttpExecutionContext(null);
|
||||
ertrs.context = new BasicHttpContext(null);
|
||||
ertrs.params = defaultParams;
|
||||
|
||||
ertrs.context.setAttribute
|
||||
(HttpExecutionContext.HTTP_TARGET_HOST, target);
|
||||
(ExecutionContext.HTTP_TARGET_HOST, target);
|
||||
ertrs.context.setAttribute
|
||||
(HttpExecutionContext.HTTP_REQUEST, request);
|
||||
(ExecutionContext.HTTP_REQUEST, request);
|
||||
|
||||
threads[i] = new ExecReqThread(mgr, route, 5000L, ertrs);
|
||||
}
|
||||
|
@ -223,7 +224,7 @@ public class TestTSCCMWithServer extends ServerTestBase {
|
|||
|
||||
// repeat the communication, no need to prepare the request again
|
||||
conn.open(route, httpContext, defaultParams);
|
||||
httpContext.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
|
||||
httpContext.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
|
||||
response = httpExecutor.execute(request, conn, httpContext);
|
||||
httpExecutor.postProcess(response, httpProcessor, httpContext);
|
||||
|
||||
|
@ -243,7 +244,7 @@ public class TestTSCCMWithServer extends ServerTestBase {
|
|||
assertTrue("connection should have been open", conn.isOpen());
|
||||
|
||||
// repeat the communication, no need to prepare the request again
|
||||
httpContext.setAttribute(HttpExecutionContext.HTTP_CONNECTION, conn);
|
||||
httpContext.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
|
||||
response = httpExecutor.execute(request, conn, httpContext);
|
||||
httpExecutor.postProcess(response, httpProcessor, httpContext);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.apache.http.params.HttpParams;
|
|||
import org.apache.http.params.HttpProtocolParams;
|
||||
import org.apache.http.protocol.BasicHttpProcessor;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.BasicHttpContext;
|
||||
import org.apache.http.protocol.HttpRequestHandler;
|
||||
import org.apache.http.protocol.HttpRequestHandlerRegistry;
|
||||
import org.apache.http.protocol.HttpService;
|
||||
|
@ -365,7 +365,7 @@ public class LocalTestServer {
|
|||
|
||||
|
||||
public void run() {
|
||||
HttpContext context = new HttpExecutionContext(null);
|
||||
HttpContext context = new BasicHttpContext(null);
|
||||
try {
|
||||
while ((servicedSocket != null) &&
|
||||
this.conn.isOpen() && !Thread.interrupted()) {
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.http.params.BasicHttpParams;
|
|||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.params.HttpProtocolParams;
|
||||
import org.apache.http.protocol.BasicHttpProcessor;
|
||||
import org.apache.http.protocol.HttpExecutionContext;
|
||||
import org.apache.http.protocol.BasicHttpContext;
|
||||
import org.apache.http.protocol.HttpRequestExecutor;
|
||||
import org.apache.http.protocol.RequestConnControl;
|
||||
import org.apache.http.protocol.RequestContent;
|
||||
|
@ -74,7 +74,7 @@ public abstract class ServerTestBase extends TestCase {
|
|||
protected BasicHttpProcessor httpProcessor;
|
||||
|
||||
/** The default context for the client side. */
|
||||
protected HttpExecutionContext httpContext;
|
||||
protected BasicHttpContext httpContext;
|
||||
|
||||
/** The request executor for the client side. */
|
||||
protected HttpRequestExecutor httpExecutor;
|
||||
|
@ -135,7 +135,7 @@ public abstract class ServerTestBase extends TestCase {
|
|||
}
|
||||
|
||||
// the context is created each time, it may get modified by test cases
|
||||
httpContext = new HttpExecutionContext(null);
|
||||
httpContext = new BasicHttpContext(null);
|
||||
|
||||
if (httpExecutor == null) {
|
||||
httpExecutor = new HttpRequestExecutor();
|
||||
|
|
Loading…
Reference in New Issue