Package com.helger.httpclient
Class HttpClientFactory
java.lang.Object
com.helger.httpclient.HttpClientFactory
- All Implemented Interfaces:
IHttpClientProvider
A factory for creating
CloseableHttpClient that is e.g. to be used in the
HttpClientManager.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.HttpClientFactory(HttpClientSettings aSettings) Constructor with explicit settings. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hc.client5.http.config.ConnectionConfigorg.apache.hc.client5.http.config.ConnectionConfig.Builderorg.apache.hc.client5.http.io.HttpClientConnectionManagercreateConnectionManager(org.apache.hc.client5.http.ssl.TlsSocketStrategy aTlsSocketFactory) org.apache.hc.core5.http.ConnectionReuseStrategyorg.apache.hc.client5.http.auth.CredentialsProviderprotected org.apache.hc.client5.http.ssl.TlsSocketStrategyorg.apache.hc.client5.http.DnsResolverorg.apache.hc.client5.http.impl.classic.CloseableHttpClientCreate a new closeable HttpClient object.org.apache.hc.client5.http.impl.classic.HttpClientBuilderorg.apache.hc.client5.http.config.RequestConfigorg.apache.hc.client5.http.config.RequestConfig.Builderorg.apache.hc.client5.http.HttpRequestRetryStrategycreateRequestRetryStrategy(int nMaxRetries, org.apache.hc.core5.util.TimeValue aRetryInterval, boolean bRetryAlways) org.apache.hc.client5.http.routing.HttpRoutePlannercreateRoutePlanner(org.apache.hc.client5.http.SchemePortResolver aSchemePortResolver) org.apache.hc.client5.http.SchemePortResolverCreate the scheme to port resolver.org.apache.hc.core5.http.io.SocketConfigorg.apache.hc.core5.http.io.SocketConfig.Builderorg.apache.hc.client5.http.ssl.TlsSocketStrategyfinal HttpClientSettings
-
Constructor Details
-
HttpClientFactory
public HttpClientFactory()Default constructor. -
HttpClientFactory
Constructor with explicit settings.- Parameters:
aSettings- The settings to be used. May not benull.
-
-
Method Details
-
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
PoolingHttpClientConnectionManagerto 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 benullto 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:IHttpClientProviderCreate a new closeable HttpClient object.- Specified by:
createHttpClientin interfaceIHttpClientProvider- Returns:
- A new object. May not be
null.
-