Package org.apache.http.impl.client
Class DefaultRequestDirector
java.lang.Object
org.apache.http.impl.client.DefaultRequestDirector
- All Implemented Interfaces:
RequestDirector
Deprecated.
Do not use.
Default implementation of
RequestDirector.
The following parameters can be used to customize the behavior of this class:
CoreProtocolPNames.PROTOCOL_VERSIONCoreProtocolPNames.STRICT_TRANSFER_ENCODINGCoreProtocolPNames.HTTP_ELEMENT_CHARSETCoreProtocolPNames.USE_EXPECT_CONTINUECoreProtocolPNames.WAIT_FOR_CONTINUECoreProtocolPNames.USER_AGENTCoreConnectionPNames.SOCKET_BUFFER_SIZECoreConnectionPNames.MAX_LINE_LENGTHCoreConnectionPNames.MAX_HEADER_COUNTCoreConnectionPNames.SO_TIMEOUTCoreConnectionPNames.SO_LINGERCoreConnectionPNames.SO_REUSEADDRCoreConnectionPNames.TCP_NODELAYCoreConnectionPNames.CONNECTION_TIMEOUTCoreConnectionPNames.STALE_CONNECTION_CHECKConnRoutePNames.FORCED_ROUTEConnRoutePNames.LOCAL_ADDRESSConnRoutePNames.DEFAULT_PROXYCookieSpecPNames.DATE_PATTERNSCookieSpecPNames.SINGLE_COOKIE_HEADERAuthPNames.CREDENTIAL_CHARSETClientPNames.COOKIE_POLICYClientPNames.HANDLE_AUTHENTICATIONClientPNames.HANDLE_REDIRECTSClientPNames.MAX_REDIRECTSClientPNames.ALLOW_CIRCULAR_REDIRECTSClientPNames.VIRTUAL_HOSTClientPNames.DEFAULT_HOSTClientPNames.DEFAULT_HEADERSClientPNames.CONN_MANAGER_TIMEOUT
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpAuthenticatorDeprecated.protected final ClientConnectionManagerDeprecated.The connection manager.private intDeprecated.protected final org.apache.http.protocol.HttpProcessorDeprecated.The HTTP protocol processor.protected final ConnectionKeepAliveStrategyDeprecated.The keep-alive duration strategy.private final org.apache.commons.logging.LogDeprecated.protected ManagedClientConnectionDeprecated.The currently allocated connection.private final intDeprecated.protected final org.apache.http.params.HttpParamsDeprecated.The HTTP parameters.protected final AuthenticationHandlerDeprecated.The proxy authentication handler.protected final AuthStateDeprecated.protected final AuthenticationStrategyDeprecated.The proxy authentication handler.private intDeprecated.protected final RedirectHandlerDeprecated.The redirect handler.protected final RedirectStrategyDeprecated.The redirect strategy.protected final org.apache.http.protocol.HttpRequestExecutorDeprecated.The request executor.protected final HttpRequestRetryHandlerDeprecated.The request retry handler.protected final org.apache.http.ConnectionReuseStrategyDeprecated.The connection re-use strategy.protected final HttpRoutePlannerDeprecated.The route planner.protected final AuthenticationHandlerDeprecated.The target authentication handler.protected final AuthStateDeprecated.protected final AuthenticationStrategyDeprecated.The target authentication handler.protected final UserTokenHandlerDeprecated.The user token handler.private org.apache.http.HttpHostDeprecated. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectStrategy redirectStrategy, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated.DefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectStrategy redirectStrategy, AuthenticationStrategy targetAuthStrategy, AuthenticationStrategy proxyAuthStrategy, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated.DefaultRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidDeprecated.Shuts down the connection.protected org.apache.http.HttpRequestcreateConnectRequest(HttpRoute route, org.apache.http.protocol.HttpContext context) Deprecated.Creates the CONNECT request for tunnelling.protected booleancreateTunnelToProxy(HttpRoute route, int hop, org.apache.http.protocol.HttpContext context) Deprecated.Creates a tunnel to an intermediate proxy.protected booleancreateTunnelToTarget(HttpRoute route, org.apache.http.protocol.HttpContext context) Deprecated.Creates a tunnel to the target server.protected HttpRoutedetermineRoute(org.apache.http.HttpHost targetHost, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) Deprecated.Determines the route for a request.protected voidestablishRoute(HttpRoute route, org.apache.http.protocol.HttpContext context) Deprecated.Establishes the target route.org.apache.http.HttpResponseexecute(org.apache.http.HttpHost targetHost, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) Deprecated.Executes a request.protected RoutedRequesthandleResponse(RoutedRequest roureq, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) Deprecated.Analyzes a response to check need for a followup.protected voidDeprecated.Returns the connection back to the connection manager and prepares for retrieving a new connection during the next request.protected voidrewriteRequestURI(RequestWrapper request, HttpRoute route) Deprecated.private voidtryConnect(RoutedRequest req, org.apache.http.protocol.HttpContext context) Deprecated.Establish connection either directly or through a tunnel and retry in case of a recoverable I/O failureprivate org.apache.http.HttpResponsetryExecute(RoutedRequest req, org.apache.http.protocol.HttpContext context) Deprecated.Execute request and retry in case of a recoverable I/O failureprivate RequestWrapperwrapRequest(org.apache.http.HttpRequest request) Deprecated.
-
Field Details
-
log
private final org.apache.commons.logging.Log logDeprecated. -
connManager
Deprecated.The connection manager. -
routePlanner
Deprecated.The route planner. -
reuseStrategy
protected final org.apache.http.ConnectionReuseStrategy reuseStrategyDeprecated.The connection re-use strategy. -
keepAliveStrategy
Deprecated.The keep-alive duration strategy. -
requestExec
protected final org.apache.http.protocol.HttpRequestExecutor requestExecDeprecated.The request executor. -
httpProcessor
protected final org.apache.http.protocol.HttpProcessor httpProcessorDeprecated.The HTTP protocol processor. -
retryHandler
Deprecated.The request retry handler. -
redirectHandler
Deprecated.The redirect handler. -
redirectStrategy
Deprecated.The redirect strategy. -
targetAuthHandler
Deprecated.The target authentication handler. -
targetAuthStrategy
Deprecated.The target authentication handler. -
proxyAuthHandler
Deprecated.The proxy authentication handler. -
proxyAuthStrategy
Deprecated.The proxy authentication handler. -
userTokenHandler
Deprecated.The user token handler. -
params
protected final org.apache.http.params.HttpParams paramsDeprecated.The HTTP parameters. -
managedConn
Deprecated.The currently allocated connection. -
targetAuthState
Deprecated. -
proxyAuthState
Deprecated. -
authenticator
Deprecated. -
execCount
private int execCountDeprecated. -
redirectCount
private int redirectCountDeprecated. -
maxRedirects
private final int maxRedirectsDeprecated. -
virtualHost
private org.apache.http.HttpHost virtualHostDeprecated.
-
-
Constructor Details
-
DefaultRequestDirector
public DefaultRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated. -
DefaultRequestDirector
public DefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectStrategy redirectStrategy, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated. -
DefaultRequestDirector
public DefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectStrategy redirectStrategy, AuthenticationStrategy targetAuthStrategy, AuthenticationStrategy proxyAuthStrategy, UserTokenHandler userTokenHandler, org.apache.http.params.HttpParams params) Deprecated.- Since:
- 4.2
-
-
Method Details
-
wrapRequest
private RequestWrapper wrapRequest(org.apache.http.HttpRequest request) throws org.apache.http.ProtocolException Deprecated.- Throws:
org.apache.http.ProtocolException
-
rewriteRequestURI
protected void rewriteRequestURI(RequestWrapper request, HttpRoute route) throws org.apache.http.ProtocolException Deprecated.- Throws:
org.apache.http.ProtocolException
-
execute
public org.apache.http.HttpResponse execute(org.apache.http.HttpHost targetHost, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Description copied from interface:RequestDirectorExecutes a request.Note: For the time being, a new director is instantiated for each request. This is the same behavior as for
HttpMethodDirectorin HttpClient 3.- Specified by:
executein interfaceRequestDirector- Parameters:
targetHost- the target host for the request. Implementations may acceptnullif they can still determine a route, for example to a default target or by inspecting the request.request- the request to executecontext- the context for executing the request- Returns:
- the final response to the request. This is never an intermediate response with status code 1xx.
- Throws:
org.apache.http.HttpException- in case of a problemIOException- in case of an IO problem or if the connection was aborted
-
tryConnect
private void tryConnect(RoutedRequest req, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Establish connection either directly or through a tunnel and retry in case of a recoverable I/O failure- Throws:
org.apache.http.HttpExceptionIOException
-
tryExecute
private org.apache.http.HttpResponse tryExecute(RoutedRequest req, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Execute request and retry in case of a recoverable I/O failure- Throws:
org.apache.http.HttpExceptionIOException
-
releaseConnection
protected void releaseConnection()Deprecated.Returns the connection back to the connection manager and prepares for retrieving a new connection during the next request. -
determineRoute
protected HttpRoute determineRoute(org.apache.http.HttpHost targetHost, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException Deprecated.Determines the route for a request. Called byexecute(org.apache.http.HttpHost, org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext)to determine the route for either the original or a followup request.- Parameters:
targetHost- the target host for the request. Implementations may acceptnullif they can still determine a route, for example to a default target or by inspecting the request.request- the request to executecontext- the context to use for the execution, nevernull- Returns:
- the route the request should take
- Throws:
org.apache.http.HttpException- in case of a problem
-
establishRoute
protected void establishRoute(HttpRoute route, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Establishes the target route.- Parameters:
route- the route to establishcontext- the context for the request execution- Throws:
org.apache.http.HttpException- in case of a problemIOException- in case of an IO problem
-
createTunnelToTarget
protected boolean createTunnelToTarget(HttpRoute route, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Creates a tunnel to the target server. The connection must be established to the (last) proxy. A CONNECT request for tunnelling through the proxy will be created and sent, the response received and checked. This method does not update the connection with information about the tunnel, that is left to the caller.- Parameters:
route- the route to establishcontext- the context for request execution- Returns:
trueif the tunnelled route is secure,falseotherwise. The implementation here always returnsfalse, but derived classes may override.- Throws:
org.apache.http.HttpException- in case of a problemIOException- in case of an IO problem
-
createTunnelToProxy
protected boolean createTunnelToProxy(HttpRoute route, int hop, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Creates a tunnel to an intermediate proxy. This method is not implemented in this class. It just throws an exception here.- Parameters:
route- the route to establishhop- the hop in the route to establish now.route.getHopTarget(hop)will return the proxy to tunnel to.context- the context for request execution- Returns:
trueif the partially tunnelled connection is secure,falseotherwise.- Throws:
org.apache.http.HttpException- in case of a problemIOException- in case of an IO problem
-
createConnectRequest
protected org.apache.http.HttpRequest createConnectRequest(HttpRoute route, org.apache.http.protocol.HttpContext context) Deprecated.Creates the CONNECT request for tunnelling. Called bycreateTunnelToTarget.- Parameters:
route- the route to establishcontext- the context for request execution- Returns:
- the CONNECT request for tunnelling
-
handleResponse
protected RoutedRequest handleResponse(RoutedRequest roureq, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException Deprecated.Analyzes a response to check need for a followup.- Parameters:
roureq- the request and route.response- the response to analayzecontext- the context used for the current request execution- Returns:
- the followup request and route if there is a followup, or
nullif the response should be returned as is - Throws:
org.apache.http.HttpException- in case of a problemIOException- in case of an IO problem
-
abortConnection
private void abortConnection()Deprecated.Shuts down the connection. This method is called from acatchblock inexecuteduring exception handling.
-