org.apache.hc.core5.http.impl.bootstrap

## Class HttpRequester

- java.lang.Object
- - org.apache.hc.core5.http.impl.bootstrap.HttpRequester

- All Implemented Interfaces:
    Closeable, AutoCloseable, ModalCloseable, ConnPoolControl<HttpHost>, ConnPoolStats<HttpHost>

      public class HttpRequester
      extends Object
      implements ConnPoolControl<HttpHost>, ModalCloseable

  HTTP/1.1 client side message exchange initiator.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpRequester(HttpRequestExecutor requestExecutor, HttpProcessor httpProcessor, ManagedConnPool<HttpHost,HttpClientConnection> connPool, SocketConfig socketConfig, HttpConnectionFactory<? extends HttpClientConnection> connectFactory, SSLSocketFactory sslSocketFactory, Callback<SSLParameters> sslSetupHandler, SSLSessionVerifier sslSessionVerifier, Resolver<HttpHost,InetSocketAddress> addressResolver)` Use `RequesterBootstrap` to create instances of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `close(CloseMode closeMode)` Closes this process or endpoint and releases any system resources associated with it.
    `void` | `closeExpired()`
    `void` | `closeIdle(TimeValue idleTime)`
    `ClassicHttpResponse` | `execute(HttpClientConnection connection, ClassicHttpRequest request, HttpContext context)`
    `<T> T` | `execute(HttpClientConnection connection, ClassicHttpRequest request, HttpContext context, HttpClientResponseHandler<T> responseHandler)`
    `ClassicHttpResponse` | `execute(HttpClientConnection connection, ClassicHttpRequest request, HttpResponseInformationCallback informationCallback, HttpContext context)`
    `ClassicHttpResponse` | `execute(HttpHost targetHost, ClassicHttpRequest request, HttpResponseInformationCallback informationCallback, Timeout connectTimeout, HttpContext context)`
    `ClassicHttpResponse` | `execute(HttpHost targetHost, ClassicHttpRequest request, Timeout connectTimeout, HttpContext context)`
    `<T> T` | `execute(HttpHost targetHost, ClassicHttpRequest request, Timeout connectTimeout, HttpContext context, HttpClientResponseHandler<T> responseHandler)`
    `ConnPoolControl<HttpHost>` | `getConnPoolControl()`
    `int` | `getDefaultMaxPerRoute()`
    `int` | `getMaxPerRoute(HttpHost route)`
    `int` | `getMaxTotal()`
    `Set<HttpHost>` | `getRoutes()`
    `PoolStats` | `getStats(HttpHost route)`
    `PoolStats` | `getTotalStats()`
    `boolean` | `keepAlive(HttpClientConnection connection, ClassicHttpRequest request, ClassicHttpResponse response, HttpContext context)`
    `void` | `setDefaultMaxPerRoute(int max)`
    `void` | `setMaxPerRoute(HttpHost route, int max)`
    `void` | `setMaxTotal(int max)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpRequester

          @Internal
          public HttpRequester(HttpRequestExecutor requestExecutor,
                                         HttpProcessor httpProcessor,
                                         ManagedConnPool<HttpHost,HttpClientConnection> connPool,
                                         SocketConfig socketConfig,
                                         HttpConnectionFactory<? extends HttpClientConnection> connectFactory,
                                         SSLSocketFactory sslSocketFactory,
                                         Callback<SSLParameters> sslSetupHandler,
                                         SSLSessionVerifier sslSessionVerifier,
                                         Resolver<HttpHost,InetSocketAddress> addressResolver)

      Use `RequesterBootstrap` to create instances of this class.

  - ### Method Detail

    - #### getTotalStats

          public PoolStats getTotalStats()

      Specified by:
        `getTotalStats` in interface `ConnPoolStats<HttpHost>`

    - #### getStats

          public PoolStats getStats(HttpHost route)

      Specified by:
        `getStats` in interface `ConnPoolStats<HttpHost>`

    - #### setMaxTotal

          public void setMaxTotal(int max)

      Specified by:
        `setMaxTotal` in interface `ConnPoolControl<HttpHost>`

    - #### getMaxTotal

          public int getMaxTotal()

      Specified by:
        `getMaxTotal` in interface `ConnPoolControl<HttpHost>`

    - #### setDefaultMaxPerRoute

          public void setDefaultMaxPerRoute(int max)

      Specified by:
        `setDefaultMaxPerRoute` in interface `ConnPoolControl<HttpHost>`

    - #### getDefaultMaxPerRoute

          public int getDefaultMaxPerRoute()

      Specified by:
        `getDefaultMaxPerRoute` in interface `ConnPoolControl<HttpHost>`

    - #### setMaxPerRoute

          public void setMaxPerRoute(HttpHost route,
                                     int max)

      Specified by:
        `setMaxPerRoute` in interface `ConnPoolControl<HttpHost>`

    - #### getMaxPerRoute

          public int getMaxPerRoute(HttpHost route)

      Specified by:
        `getMaxPerRoute` in interface `ConnPoolControl<HttpHost>`

    - #### closeIdle

          public void closeIdle(TimeValue idleTime)

      Specified by:
        `closeIdle` in interface `ConnPoolControl<HttpHost>`

    - #### closeExpired

          public void closeExpired()

      Specified by:
        `closeExpired` in interface `ConnPoolControl<HttpHost>`

    - #### getRoutes

          public Set<HttpHost> getRoutes()

      Specified by:
        `getRoutes` in interface `ConnPoolControl<HttpHost>`

    - #### execute

          public ClassicHttpResponse execute(HttpClientConnection connection,
                                             ClassicHttpRequest request,
                                             HttpResponseInformationCallback informationCallback,
                                             HttpContext context)
                                      throws HttpException,
                                             IOException

      Throws:
        `HttpException`
        `IOException`

    - #### execute

          public ClassicHttpResponse execute(HttpClientConnection connection,
                                             ClassicHttpRequest request,
                                             HttpContext context)
                                      throws HttpException,
                                             IOException

      Throws:
        `HttpException`
        `IOException`

    - #### keepAlive

          public boolean keepAlive(HttpClientConnection connection,
                                   ClassicHttpRequest request,
                                   ClassicHttpResponse response,
                                   HttpContext context)
                            throws IOException

      Throws:
        `IOException`

    - #### execute

          public <T> T execute(HttpClientConnection connection,
                               ClassicHttpRequest request,
                               HttpContext context,
                               HttpClientResponseHandler<T> responseHandler)
                        throws HttpException,
                               IOException

      Throws:
        `HttpException`
        `IOException`

    - #### execute

          public ClassicHttpResponse execute(HttpHost targetHost,
                                             ClassicHttpRequest request,
                                             HttpResponseInformationCallback informationCallback,
                                             Timeout connectTimeout,
                                             HttpContext context)
                                      throws HttpException,
                                             IOException

      Throws:
        `HttpException`
        `IOException`

    - #### execute

          public ClassicHttpResponse execute(HttpHost targetHost,
                                             ClassicHttpRequest request,
                                             Timeout connectTimeout,
                                             HttpContext context)
                                      throws HttpException,
                                             IOException

      Throws:
        `HttpException`
        `IOException`

    - #### execute

          public <T> T execute(HttpHost targetHost,
                               ClassicHttpRequest request,
                               Timeout connectTimeout,
                               HttpContext context,
                               HttpClientResponseHandler<T> responseHandler)
                        throws HttpException,
                               IOException

      Throws:
        `HttpException`
        `IOException`

    - #### getConnPoolControl

          public ConnPoolControl<HttpHost> getConnPoolControl()

    - #### close

          public void close(CloseMode closeMode)

      Description copied from interface: `ModalCloseable`
      Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
      Specified by:
        `close` in interface `ModalCloseable`
      Parameters:
        `closeMode` - How to close the receiver.

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.