|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.client.DefaultRequestDirector
public class DefaultRequestDirector
Default implementation of RequestDirector
.
This class replaces the HttpMethodDirector
in HttpClient 3.
Field Summary | |
---|---|
protected ClientConnectionManager |
connManager
The connection manager. |
protected org.apache.http.protocol.HttpProcessor |
httpProcessor
The HTTP protocol processor. |
protected ConnectionKeepAliveStrategy |
keepAliveStrategy
The keep-alive duration strategy. |
protected ManagedClientConnection |
managedConn
The currently allocated connection. |
protected org.apache.http.params.HttpParams |
params
The HTTP parameters. |
protected RedirectHandler |
redirectHandler
The redirect handler. |
protected org.apache.http.protocol.HttpRequestExecutor |
requestExec
The request executor. |
protected HttpRequestRetryHandler |
retryHandler
The request retry handler. |
protected org.apache.http.ConnectionReuseStrategy |
reuseStrategy
The connection re-use strategy. |
protected HttpRoutePlanner |
routePlanner
The route planner. |
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
protected org.apache.http.HttpRequest |
createConnectRequest(HttpRoute route,
org.apache.http.protocol.HttpContext context)
Creates the CONNECT request for tunnelling. |
protected boolean |
createTunnelToProxy(HttpRoute route,
int hop,
org.apache.http.protocol.HttpContext context)
Creates a tunnel to an intermediate proxy. |
protected boolean |
createTunnelToTarget(HttpRoute route,
org.apache.http.protocol.HttpContext context)
Creates a tunnel to the target server. |
protected HttpRoute |
determineRoute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context)
Determines the route for a request. |
protected void |
establishRoute(HttpRoute route,
org.apache.http.protocol.HttpContext context)
Establishes the target route. |
org.apache.http.HttpResponse |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context)
Executes a request. |
protected RoutedRequest |
handleResponse(RoutedRequest roureq,
org.apache.http.HttpResponse response,
org.apache.http.protocol.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 org.apache.http.ConnectionReuseStrategy reuseStrategy
protected final ConnectionKeepAliveStrategy keepAliveStrategy
protected final org.apache.http.protocol.HttpRequestExecutor requestExec
protected final org.apache.http.protocol.HttpProcessor httpProcessor
protected final HttpRequestRetryHandler retryHandler
protected final RedirectHandler redirectHandler
protected final org.apache.http.params.HttpParams params
protected ManagedClientConnection managedConn
Constructor Detail |
---|
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)
Method Detail |
---|
protected void rewriteRequestURI(RequestWrapper request, HttpRoute route) throws org.apache.http.ProtocolException
org.apache.http.ProtocolException
public org.apache.http.HttpResponse execute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.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
org.apache.http.HttpException
- in case of a problem
java.io.IOException
- in case of an IO problem
or if the connection was abortedprotected void releaseConnection()
protected HttpRoute determineRoute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws org.apache.http.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
org.apache.http.HttpException
- in case of a problemprotected void establishRoute(HttpRoute route, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.IOException
route
- the route to establishcontext
- the context for the request execution
org.apache.http.HttpException
- in case of a problem
java.io.IOException
- in case of an IO problemprotected boolean createTunnelToTarget(HttpRoute route, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.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.
org.apache.http.HttpException
- in case of a problem
java.io.IOException
- in case of an IO problemprotected boolean createTunnelToProxy(HttpRoute route, int hop, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.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.
org.apache.http.HttpException
- in case of a problem
java.io.IOException
- in case of an IO problemprotected org.apache.http.HttpRequest createConnectRequest(HttpRoute route, org.apache.http.protocol.HttpContext context)
createTunnelToTarget
.
route
- the route to establishcontext
- the context for request execution
protected RoutedRequest handleResponse(RoutedRequest roureq, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.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
org.apache.http.HttpException
- in case of a problem
java.io.IOException
- in case of an IO problem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |