Class DefaultRequestDirector

java.lang.Object
org.robolectric.shadows.httpclient.DefaultRequestDirector
All Implemented Interfaces:
org.apache.http.client.RequestDirector

@Deprecated public class DefaultRequestDirector extends Object implements org.apache.http.client.RequestDirector
Deprecated.
Apache HTTP client is deprecated in Android. Please migrate to an other solution
Default implementation of RequestDirector.

The following parameters can be used to customize the behavior of this class:

Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ClientConnectionManager
    Deprecated.
    The connection manager.
    protected final org.apache.http.protocol.HttpProcessor
    Deprecated.
    The HTTP protocol processor.
    Deprecated.
    The keep-alive duration strategy.
    Deprecated.
    The currently allocated connection.
    protected final HttpParams
    Deprecated.
    The HTTP parameters.
    protected final org.apache.http.client.AuthenticationHandler
    Deprecated.
    The proxy authentication handler.
    protected final org.apache.http.auth.AuthState
    Deprecated.
     
    protected final org.apache.http.client.RedirectHandler
    Deprecated.
    The redirect handler.
    protected final org.apache.http.protocol.HttpRequestExecutor
    Deprecated.
    The request executor.
    protected final org.apache.http.client.HttpRequestRetryHandler
    Deprecated.
    The request retry handler.
    protected final org.apache.http.ConnectionReuseStrategy
    Deprecated.
    The connection re-use strategy.
    protected final org.apache.http.conn.routing.HttpRoutePlanner
    Deprecated.
    The route planner.
    protected final org.apache.http.client.AuthenticationHandler
    Deprecated.
    The target authentication handler.
    protected final org.apache.http.auth.AuthState
    Deprecated.
     
    protected final org.apache.http.client.UserTokenHandler
    Deprecated.
    The user token handler.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, org.apache.http.conn.routing.HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.client.HttpRequestRetryHandler retryHandler, org.apache.http.client.RedirectHandler redirectHandler, org.apache.http.client.AuthenticationHandler targetAuthHandler, org.apache.http.client.AuthenticationHandler proxyAuthHandler, org.apache.http.client.UserTokenHandler userTokenHandler, HttpParams params)
    Deprecated.
     
    DefaultRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, org.apache.http.conn.routing.HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.client.HttpRequestRetryHandler retryHandler, org.apache.http.client.RedirectHandler redirectHandler, org.apache.http.client.AuthenticationHandler targetAuthHandler, org.apache.http.client.AuthenticationHandler proxyAuthHandler, org.apache.http.client.UserTokenHandler userTokenHandler, HttpParams params)
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.http.HttpRequest
    createConnectRequest(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context)
    Deprecated.
    Creates the CONNECT request for tunnelling.
    protected boolean
    createTunnelToProxy(org.apache.http.conn.routing.HttpRoute route, int hop, org.apache.http.protocol.HttpContext context)
    Deprecated.
    Creates a tunnel to an intermediate proxy.
    protected boolean
    createTunnelToTarget(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context)
    Deprecated.
    Creates a tunnel to the target server.
    protected org.apache.http.conn.routing.HttpRoute
    determineRoute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)
    Deprecated.
    Determines the route for a request.
    protected void
    establishRoute(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context)
    Deprecated.
    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)
    Deprecated.
     
    protected org.apache.http.impl.client.RoutedRequest
    handleResponse(org.apache.http.impl.client.RoutedRequest roureq, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context)
    Deprecated.
    Analyzes a response to check need for a followup.
    protected void
    Deprecated.
    Returns the connection back to the connection manager and prepares for retrieving a new connection during the next request.
    protected void
    rewriteRequestURI(org.apache.http.impl.client.RequestWrapper request, org.apache.http.conn.routing.HttpRoute route)
    Deprecated.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • connManager

      protected final ClientConnectionManager connManager
      Deprecated.
      The connection manager.
    • routePlanner

      protected final org.apache.http.conn.routing.HttpRoutePlanner routePlanner
      Deprecated.
      The route planner.
    • reuseStrategy

      protected final org.apache.http.ConnectionReuseStrategy reuseStrategy
      Deprecated.
      The connection re-use strategy.
    • keepAliveStrategy

      protected final ConnectionKeepAliveStrategy keepAliveStrategy
      Deprecated.
      The keep-alive duration strategy.
    • requestExec

      protected final org.apache.http.protocol.HttpRequestExecutor requestExec
      Deprecated.
      The request executor.
    • httpProcessor

      protected final org.apache.http.protocol.HttpProcessor httpProcessor
      Deprecated.
      The HTTP protocol processor.
    • retryHandler

      protected final org.apache.http.client.HttpRequestRetryHandler retryHandler
      Deprecated.
      The request retry handler.
    • redirectHandler

      protected final org.apache.http.client.RedirectHandler redirectHandler
      Deprecated.
      The redirect handler.
    • targetAuthHandler

      protected final org.apache.http.client.AuthenticationHandler targetAuthHandler
      Deprecated.
      The target authentication handler.
    • proxyAuthHandler

      protected final org.apache.http.client.AuthenticationHandler proxyAuthHandler
      Deprecated.
      The proxy authentication handler.
    • userTokenHandler

      protected final org.apache.http.client.UserTokenHandler userTokenHandler
      Deprecated.
      The user token handler.
    • params

      protected final HttpParams params
      Deprecated.
      The HTTP parameters.
    • managedConn

      protected ManagedClientConnection managedConn
      Deprecated.
      The currently allocated connection.
    • targetAuthState

      protected final org.apache.http.auth.AuthState targetAuthState
      Deprecated.
    • proxyAuthState

      protected final org.apache.http.auth.AuthState proxyAuthState
      Deprecated.
  • Constructor Details

    • DefaultRequestDirector

      public DefaultRequestDirector(org.apache.commons.logging.Log log, org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, org.apache.http.conn.routing.HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.client.HttpRequestRetryHandler retryHandler, org.apache.http.client.RedirectHandler redirectHandler, org.apache.http.client.AuthenticationHandler targetAuthHandler, org.apache.http.client.AuthenticationHandler proxyAuthHandler, org.apache.http.client.UserTokenHandler userTokenHandler, HttpParams params)
      Deprecated.
    • DefaultRequestDirector

      public DefaultRequestDirector(org.apache.http.protocol.HttpRequestExecutor requestExec, ClientConnectionManager conman, org.apache.http.ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, org.apache.http.conn.routing.HttpRoutePlanner rouplan, org.apache.http.protocol.HttpProcessor httpProcessor, org.apache.http.client.HttpRequestRetryHandler retryHandler, org.apache.http.client.RedirectHandler redirectHandler, org.apache.http.client.AuthenticationHandler targetAuthHandler, org.apache.http.client.AuthenticationHandler proxyAuthHandler, org.apache.http.client.UserTokenHandler userTokenHandler, HttpParams params)
      Deprecated.
  • Method Details

    • rewriteRequestURI

      protected void rewriteRequestURI(org.apache.http.impl.client.RequestWrapper request, org.apache.http.conn.routing.HttpRoute route) throws org.apache.http.ProtocolException
      Deprecated.
      Throws:
      org.apache.http.ProtocolException
    • execute

      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, IOException
      Deprecated.
      Specified by:
      execute in interface org.apache.http.client.RequestDirector
      Throws:
      org.apache.http.HttpException
      IOException
    • 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 org.apache.http.conn.routing.HttpRoute determineRoute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException
      Deprecated.
      Determines the route for a request. Called by 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.
      Parameters:
      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 execute
      context - the context to use for the execution, never null
      Returns:
      the route the request should take
      Throws:
      org.apache.http.HttpException - in case of a problem
    • establishRoute

      protected void establishRoute(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context) throws org.apache.http.HttpException, IOException
      Deprecated.
      Establishes the target route.
      Parameters:
      route - the route to establish
      context - the context for the request execution
      Throws:
      org.apache.http.HttpException - in case of a problem
      IOException - in case of an IO problem
    • createTunnelToTarget

      protected boolean createTunnelToTarget(org.apache.http.conn.routing.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 establish
      context - the context for request execution
      Returns:
      true if the tunnelled route is secure, false otherwise. The implementation here always returns false, but derived classes may override.
      Throws:
      org.apache.http.HttpException - in case of a problem
      IOException - in case of an IO problem
    • createTunnelToProxy

      protected boolean createTunnelToProxy(org.apache.http.conn.routing.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 establish
      hop - 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:
      true if the partially tunnelled connection is secure, false otherwise.
      Throws:
      org.apache.http.HttpException - in case of a problem
      IOException - in case of an IO problem
    • createConnectRequest

      protected org.apache.http.HttpRequest createConnectRequest(org.apache.http.conn.routing.HttpRoute route, org.apache.http.protocol.HttpContext context)
      Deprecated.
      Creates the CONNECT request for tunnelling. Called by createTunnelToTarget.
      Parameters:
      route - the route to establish
      context - the context for request execution
      Returns:
      the CONNECT request for tunnelling
    • handleResponse

      protected org.apache.http.impl.client.RoutedRequest handleResponse(org.apache.http.impl.client.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 analyze
      context - the context used for the current request execution
      Returns:
      the followup request and route if there is a followup, or null if the response should be returned as is
      Throws:
      org.apache.http.HttpException - in case of a problem
      IOException - in case of an IO problem