Class HttpClientFactory

java.lang.Object
com.helger.httpclient.HttpClientFactory
All Implemented Interfaces:
IHttpClientProvider

@NotThreadSafe public class HttpClientFactory extends Object implements IHttpClientProvider
A factory for creating CloseableHttpClient that is e.g. to be used in the HttpClientManager.
Author:
Philip Helger
  • Constructor Details

    • HttpClientFactory

      public HttpClientFactory()
      Default constructor.
    • HttpClientFactory

      public HttpClientFactory(@Nonnull HttpClientSettings aSettings)
      Constructor with explicit settings.
      Parameters:
      aSettings - The settings to be used. May not be null.
  • Method Details

    • httpClientSettings

      @Nonnull public final HttpClientSettings httpClientSettings()
      Returns:
      The underlying HTTP client settings. Never null. Changes to the returned object impact this HTTP client factory.
      Since:
      9.6.4
    • createSchemePortResolver

      @Nonnull public org.apache.hc.client5.http.SchemePortResolver createSchemePortResolver()
      Create the scheme to port resolver.
      Returns:
      Never null.
      Since:
      9.1.1
    • createCustomTlsSocketStrategy

      @Nullable protected org.apache.hc.client5.http.ssl.TlsSocketStrategy createCustomTlsSocketStrategy()
    • createTlsSocketStrategy

      @Nullable public org.apache.hc.client5.http.ssl.TlsSocketStrategy createTlsSocketStrategy()
    • createSocketConfigBuilder

      @Nonnull public org.apache.hc.core5.http.io.SocketConfig.Builder createSocketConfigBuilder()
      Returns:
      The socket configuration builder used by the PoolingHttpClientConnectionManager to create the default socket configuration.
    • createSocketConfig

      @Nonnull public org.apache.hc.core5.http.io.SocketConfig createSocketConfig()
      Returns:
      The default connection configuration used by the PoolingHttpClientConnectionManager.
    • createDNSResolver

      @Nullable public org.apache.hc.client5.http.DnsResolver createDNSResolver()
      Returns:
      The DNS resolver to be used for PoolingHttpClientConnectionManager. May be null to use the default.
      Since:
      8.8.0
    • createConnectionManager

      @Nonnull public org.apache.hc.client5.http.io.HttpClientConnectionManager createConnectionManager(@Nonnull org.apache.hc.client5.http.ssl.TlsSocketStrategy aTlsSocketFactory)
    • createConnectionReuseStrategy

      @Nullable public org.apache.hc.core5.http.ConnectionReuseStrategy createConnectionReuseStrategy()
    • createConnectionConfigBuilder

      @Nonnull public org.apache.hc.client5.http.config.ConnectionConfig.Builder createConnectionConfigBuilder()
    • createConnectionConfig

      @Nonnull public org.apache.hc.client5.http.config.ConnectionConfig createConnectionConfig()
    • createRequestConfigBuilder

      @Nonnull public org.apache.hc.client5.http.config.RequestConfig.Builder createRequestConfigBuilder()
    • createRequestConfig

      @Nonnull public org.apache.hc.client5.http.config.RequestConfig createRequestConfig()
    • createCredentialsProvider

      @Nullable public org.apache.hc.client5.http.auth.CredentialsProvider createCredentialsProvider()
    • createRequestRetryStrategy

      @Nullable public org.apache.hc.client5.http.HttpRequestRetryStrategy createRequestRetryStrategy(@Nonnegative int nMaxRetries, @Nonnull org.apache.hc.core5.util.TimeValue aRetryInterval, boolean bRetryAlways)
    • createRoutePlanner

      @Nullable public org.apache.hc.client5.http.routing.HttpRoutePlanner createRoutePlanner(@Nonnull org.apache.hc.client5.http.SchemePortResolver aSchemePortResolver)
    • createHttpClientBuilder

      @Nonnull public org.apache.hc.client5.http.impl.classic.HttpClientBuilder createHttpClientBuilder()
    • createHttpClient

      @Nonnull public org.apache.hc.client5.http.impl.classic.CloseableHttpClient createHttpClient()
      Description copied from interface: IHttpClientProvider
      Create a new closeable HttpClient object.
      Specified by:
      createHttpClient in interface IHttpClientProvider
      Returns:
      A new object. May not be null.