Class MainClientExec

  • All Implemented Interfaces:
    ClientExecChain

    @Contract(threading=IMMUTABLE_CONDITIONAL)
    public class MainClientExec
    extends java.lang.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 Detail

      • log

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

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

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

        private final org.apache.http.protocol.HttpProcessor proxyHttpProcessor
    • Method Detail

      • execute

        public CloseableHttpResponse execute​(HttpRoute route,
                                             HttpRequestWrapper request,
                                             HttpClientContext context,
                                             HttpExecutionAware execAware)
                                      throws java.io.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:
        java.io.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,
                            java.io.IOException
        Establishes the target route.
        Throws:
        org.apache.http.HttpException
        java.io.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,
                                             java.io.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
        java.io.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