Class MainClientExec

java.lang.Object
org.apache.http.impl.execchain.MainClientExec
All Implemented Interfaces:
ClientExecChain

@Contract(threading=IMMUTABLE_CONDITIONAL) public class MainClientExec extends Object implements ClientExecChain
The last request executor in the HTTP request execution chain that is responsible for execution of request / response exchanges with the opposite endpoint. This executor will automatically retry the request in case of an authentication challenge by an intermediate proxy or by the target server.
Since:
4.3
  • Field Details

    • log

      private final org.apache.commons.logging.Log log
    • requestExecutor

      private final org.apache.http.protocol.HttpRequestExecutor requestExecutor
    • connManager

      private final HttpClientConnectionManager connManager
    • reuseStrategy

      private final org.apache.http.ConnectionReuseStrategy reuseStrategy
    • keepAliveStrategy

      private final ConnectionKeepAliveStrategy keepAliveStrategy
    • proxyHttpProcessor

      private final org.apache.http.protocol.HttpProcessor proxyHttpProcessor
    • targetAuthStrategy

      private final AuthenticationStrategy targetAuthStrategy
    • proxyAuthStrategy

      private final AuthenticationStrategy proxyAuthStrategy
    • authenticator

      private final HttpAuthenticator authenticator
    • userTokenHandler

      private final UserTokenHandler userTokenHandler
    • routeDirector

      private final HttpRouteDirector routeDirector
  • Constructor Details

  • Method Details

    • execute

      public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request, HttpClientContext context, HttpExecutionAware execAware) throws IOException, org.apache.http.HttpException
      Description copied from interface: ClientExecChain
      Executes th request either by transmitting it to the target server or by passing it onto the next executor in the request execution chain.
      Specified by:
      execute in interface ClientExecChain
      Parameters:
      route - connection route.
      request - current request.
      context - current HTTP context.
      execAware - receiver of notifications of blocking I/O operations.
      Returns:
      HTTP response either received from the opposite endpoint or generated locally.
      Throws:
      IOException - in case of a I/O error. (this type of exceptions are potentially recoverable).
      org.apache.http.HttpException - in case of an HTTP protocol error (usually this type of exceptions are non-recoverable).
    • establishRoute

      void establishRoute(AuthState proxyAuthState, org.apache.http.HttpClientConnection managedConn, HttpRoute route, org.apache.http.HttpRequest request, HttpClientContext context) throws org.apache.http.HttpException, IOException
      Establishes the target route.
      Throws:
      org.apache.http.HttpException
      IOException
    • createTunnelToTarget

      private boolean createTunnelToTarget(AuthState proxyAuthState, org.apache.http.HttpClientConnection managedConn, HttpRoute route, org.apache.http.HttpRequest request, HttpClientContext context) throws org.apache.http.HttpException, IOException
      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.
      Throws:
      org.apache.http.HttpException
      IOException
    • createTunnelToProxy

      private boolean createTunnelToProxy(HttpRoute route, int hop, HttpClientContext context) throws org.apache.http.HttpException
      Creates a tunnel to an intermediate proxy. This method is not implemented in this class. It just throws an exception here.
      Throws:
      org.apache.http.HttpException
    • needAuthentication

      private boolean needAuthentication(AuthState targetAuthState, AuthState proxyAuthState, HttpRoute route, org.apache.http.HttpResponse response, HttpClientContext context)