|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.client.DefaultRequestDirector
@NotThreadSafe public class DefaultRequestDirector
Default implementation of RequestDirector
.
The following parameters can be used to customize the behavior of this class:
CoreProtocolPNames.PROTOCOL_VERSION
CoreProtocolPNames.STRICT_TRANSFER_ENCODING
CoreProtocolPNames.HTTP_ELEMENT_CHARSET
CoreProtocolPNames.USE_EXPECT_CONTINUE
CoreProtocolPNames.WAIT_FOR_CONTINUE
CoreProtocolPNames.USER_AGENT
CoreConnectionPNames.SOCKET_BUFFER_SIZE
CoreConnectionPNames.MAX_LINE_LENGTH
CoreConnectionPNames.MAX_HEADER_COUNT
CoreConnectionPNames.SO_TIMEOUT
CoreConnectionPNames.SO_LINGER
CoreConnectionPNames.TCP_NODELAY
CoreConnectionPNames.CONNECTION_TIMEOUT
CoreConnectionPNames.STALE_CONNECTION_CHECK
ConnRoutePNames.FORCED_ROUTE
ConnRoutePNames.LOCAL_ADDRESS
ConnRoutePNames.DEFAULT_PROXY
ConnManagerPNames.TIMEOUT
ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE
ConnManagerPNames.MAX_TOTAL_CONNECTIONS
CookieSpecPNames.DATE_PATTERNS
CookieSpecPNames.SINGLE_COOKIE_HEADER
AuthPNames.CREDENTIAL_CHARSET
ClientPNames.COOKIE_POLICY
ClientPNames.HANDLE_AUTHENTICATION
ClientPNames.HANDLE_REDIRECTS
ClientPNames.MAX_REDIRECTS
ClientPNames.ALLOW_CIRCULAR_REDIRECTS
ClientPNames.VIRTUAL_HOST
ClientPNames.DEFAULT_HOST
ClientPNames.DEFAULT_HEADERS
Field Summary | |
---|---|
protected ClientConnectionManager |
connManager
The connection manager. |
protected HttpProcessor |
httpProcessor
The HTTP protocol processor. |
protected ConnectionKeepAliveStrategy |
keepAliveStrategy
The keep-alive duration strategy. |
protected ManagedClientConnection |
managedConn
The currently allocated connection. |
protected HttpParams |
params
The HTTP parameters. |
protected AuthenticationHandler |
proxyAuthHandler
The proxy authentication handler. |
protected AuthState |
proxyAuthState
|
protected RedirectHandler |
redirectHandler
The redirect handler. |
protected HttpRequestExecutor |
requestExec
The request executor. |
protected HttpRequestRetryHandler |
retryHandler
The request retry handler. |
protected ConnectionReuseStrategy |
reuseStrategy
The connection re-use strategy. |
protected HttpRoutePlanner |
routePlanner
The route planner. |
protected AuthenticationHandler |
targetAuthHandler
The target authentication handler. |
protected AuthState |
targetAuthState
|
protected UserTokenHandler |
userTokenHandler
The user token handler. |
Constructor Summary | |
---|---|
DefaultRequestDirector(HttpRequestExecutor requestExec,
ClientConnectionManager conman,
ConnectionReuseStrategy reustrat,
ConnectionKeepAliveStrategy kastrat,
HttpRoutePlanner rouplan,
HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
UserTokenHandler userTokenHandler,
HttpParams params)
|
Method Summary | |
---|---|
protected HttpRequest |
createConnectRequest(HttpRoute route,
HttpContext context)
Creates the CONNECT request for tunnelling. |
protected boolean |
createTunnelToProxy(HttpRoute route,
int hop,
HttpContext context)
Creates a tunnel to an intermediate proxy. |
protected boolean |
createTunnelToTarget(HttpRoute route,
HttpContext context)
Creates a tunnel to the target server. |
protected HttpRoute |
determineRoute(HttpHost target,
HttpRequest request,
HttpContext context)
Determines the route for a request. |
protected void |
establishRoute(HttpRoute route,
HttpContext context)
Establishes the target route. |
HttpResponse |
execute(HttpHost target,
HttpRequest request,
HttpContext context)
Executes a request. |
protected RoutedRequest |
handleResponse(RoutedRequest roureq,
HttpResponse response,
HttpContext context)
Analyzes a response to check need for a followup. |
protected void |
releaseConnection()
Returns the connection back to the connection manager and prepares for retrieving a new connection during the next request. |
protected void |
rewriteRequestURI(RequestWrapper request,
HttpRoute route)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final ClientConnectionManager connManager
protected final HttpRoutePlanner routePlanner
protected final ConnectionReuseStrategy reuseStrategy
protected final ConnectionKeepAliveStrategy keepAliveStrategy
protected final HttpRequestExecutor requestExec
protected final HttpProcessor httpProcessor
protected final HttpRequestRetryHandler retryHandler
protected final RedirectHandler redirectHandler
protected final AuthenticationHandler targetAuthHandler
protected final AuthenticationHandler proxyAuthHandler
protected final UserTokenHandler userTokenHandler
protected final HttpParams params
protected ManagedClientConnection managedConn
protected final AuthState targetAuthState
protected final AuthState proxyAuthState
Constructor Detail |
---|
public DefaultRequestDirector(HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler userTokenHandler, HttpParams params)
Method Detail |
---|
protected void rewriteRequestURI(RequestWrapper request, HttpRoute route) throws ProtocolException
ProtocolException
public HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) throws HttpException, IOException
RequestDirector
HttpMethodDirector
in HttpClient 3.
execute
in interface RequestDirector
target
- the target host for the request.
Implementations may accept null
if 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
HttpException
- in case of a problem
IOException
- in case of an IO problem
or if the connection was abortedprotected void releaseConnection()
protected HttpRoute determineRoute(HttpHost target, HttpRequest request, HttpContext context) throws HttpException
execute(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.
target
- the target host for the request.
Implementations may accept null
if 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,
never null
HttpException
- in case of a problemprotected void establishRoute(HttpRoute route, HttpContext context) throws HttpException, IOException
route
- the route to establishcontext
- the context for the request execution
HttpException
- in case of a problem
IOException
- in case of an IO problemprotected boolean createTunnelToTarget(HttpRoute route, HttpContext context) throws HttpException, IOException
route
- the route to establishcontext
- the context for request execution
true
if the tunnelled route is secure,
false
otherwise.
The implementation here always returns false
,
but derived classes may override.
HttpException
- in case of a problem
IOException
- in case of an IO problemprotected boolean createTunnelToProxy(HttpRoute route, int hop, HttpContext context) throws HttpException, IOException
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
true
if the partially tunnelled connection
is secure, false
otherwise.
HttpException
- in case of a problem
IOException
- in case of an IO problemprotected HttpRequest createConnectRequest(HttpRoute route, HttpContext context)
createTunnelToTarget
.
route
- the route to establishcontext
- the context for request execution
protected RoutedRequest handleResponse(RoutedRequest roureq, HttpResponse response, HttpContext context) throws HttpException, IOException
roureq
- the request and route.response
- the response to analayzecontext
- the context used for the current request execution
null
if the response should be returned as is
HttpException
- in case of a problem
IOException
- in case of an IO problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |