|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.client.DefaultClientRequestDirector
public class DefaultClientRequestDirector
Default implementation of a client-side request director.
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 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. |
Constructor Summary | |
---|---|
DefaultClientRequestDirector(ClientConnectionManager conman,
org.apache.http.ConnectionReuseStrategy reustrat,
org.apache.http.protocol.HttpProcessor httpProcessor,
HttpRequestRetryHandler retryHandler,
RedirectHandler redirectHandler,
AuthenticationHandler targetAuthHandler,
AuthenticationHandler proxyAuthHandler,
org.apache.http.params.HttpParams params)
|
Method Summary | |
---|---|
protected ManagedClientConnection |
allocateConnection(HttpRoute route,
long timeout)
Obtains a connection for the target route. |
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 void |
establishRoute(HttpRoute route,
org.apache.http.protocol.HttpContext context)
Establishes the target route. |
org.apache.http.HttpResponse |
execute(RoutedRequest roureq,
org.apache.http.protocol.HttpContext context)
Executes a request. |
ManagedClientConnection |
getConnection()
Obtains the connection to which the response is tied. |
protected RoutedRequest |
handleResponse(RoutedRequest roureq,
org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
Analyzes a response to check need for a followup. |
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 org.apache.http.ConnectionReuseStrategy reuseStrategy
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 DefaultClientRequestDirector(ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, org.apache.http.protocol.HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, org.apache.http.params.HttpParams params)
Method Detail |
---|
public ManagedClientConnection getConnection()
ClientRequestDirector
getConnection
in interface ClientRequestDirector
execute
is tied, or
null
if there is nonepublic org.apache.http.HttpResponse execute(RoutedRequest roureq, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.IOException, java.lang.InterruptedException
ClientRequestDirector
HttpMethodDirector
in HttpClient 3.
execute
in interface ClientRequestDirector
roureq
- the route and 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
java.lang.InterruptedException
- in case of an interruptprotected ManagedClientConnection allocateConnection(HttpRoute route, long timeout) throws org.apache.http.HttpException, ConnectionPoolTimeoutException, java.lang.InterruptedException
route
- the route for which to allocate a connection
org.apache.http.HttpException
- in case of a (protocol) problem
ConnectionPoolTimeoutException
- in case of a timeout
java.lang.InterruptedException
- in case of an interruptprotected 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.HttpRequest request, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, java.io.IOException
roureq
- the request and route. This is the same object as
was passed to wrapRequest(HttpRequest)
.request
- the request that was actually sent. This is the object
returned by wrapRequest(HttpRequest)
.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 |