Class HttpAsyncClientBuilder
CloseableHttpAsyncClient instances.
When a particular component is not explicitly this class will
use its default implementation. System properties will be taken
into account when configuring the default implementations when
useSystemProperties() method is called prior to calling
build().
- ssl.TrustManagerFactory.algorithm
- javax.net.ssl.trustStoreType
- javax.net.ssl.trustStore
- javax.net.ssl.trustStoreProvider
- javax.net.ssl.trustStorePassword
- ssl.KeyManagerFactory.algorithm
- javax.net.ssl.keyStoreType
- javax.net.ssl.keyStore
- javax.net.ssl.keyStoreProvider
- javax.net.ssl.keyStorePassword
- https.protocols
- https.cipherSuites
- http.proxyHost
- http.proxyPort
- http.keepAlive
- http.maxConnections
- http.agent
Please note that some settings used by this class can be mutually
exclusive and may not apply when building CloseableHttpAsyncClient
instances.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> private booleanprivate NHttpClientConnectionManagerprivate booleanprivate booleanprivate org.apache.http.config.Lookup<org.apache.http.cookie.CookieSpecProvider> private org.apache.http.client.CookieStoreprivate org.apache.http.client.CredentialsProviderprivate org.apache.http.config.ConnectionConfigprivate Collection<? extends org.apache.http.Header> private org.apache.http.impl.nio.reactor.IOReactorConfigprivate org.apache.http.client.config.RequestConfigprivate org.apache.http.nio.NHttpClientEventHandlerprivate HostnameVerifierprivate org.apache.http.protocol.HttpProcessorprivate org.apache.http.conn.ConnectionKeepAliveStrategyprivate intprivate intprivate org.apache.http.HttpHostprivate org.apache.http.client.AuthenticationStrategyprivate org.apache.http.conn.util.PublicSuffixMatcherprivate org.apache.http.client.RedirectStrategyprivate LinkedList<org.apache.http.HttpRequestInterceptor> private LinkedList<org.apache.http.HttpRequestInterceptor> private LinkedList<org.apache.http.HttpResponseInterceptor> private LinkedList<org.apache.http.HttpResponseInterceptor> private org.apache.http.ConnectionReuseStrategyprivate org.apache.http.conn.routing.HttpRoutePlannerprivate org.apache.http.conn.SchemePortResolverprivate SSLContextprivate SchemeIOSessionStrategyprivate booleanprivate org.apache.http.client.AuthenticationStrategyprivate ThreadFactoryprivate Stringprivate org.apache.http.client.UserTokenHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal HttpAsyncClientBuilderaddInterceptorFirst(org.apache.http.HttpRequestInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.final HttpAsyncClientBuilderaddInterceptorFirst(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.final HttpAsyncClientBuilderaddInterceptorLast(org.apache.http.HttpRequestInterceptor itcp) Adds this protocol interceptor to the tail of the protocol processing list.final HttpAsyncClientBuilderaddInterceptorLast(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the tail of the protocol processing list.build()static HttpAsyncClientBuildercreate()final HttpAsyncClientBuilderDisables authentication scheme caching.final HttpAsyncClientBuilderDisables connection state tracking.final HttpAsyncClientBuilderDisables state (cookie) management.final HttpAsyncClientBuildersetConnectionManager(NHttpClientConnectionManager connManager) AssignsNHttpClientConnectionManagerinstance.final HttpAsyncClientBuildersetConnectionManagerShared(boolean shared) Defines the connection manager is to be shared by multiple client instances.final HttpAsyncClientBuildersetConnectionReuseStrategy(org.apache.http.ConnectionReuseStrategy reuseStrategy) AssignsConnectionReuseStrategyinstance.final HttpAsyncClientBuildersetDefaultAuthSchemeRegistry(org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authSchemeRegistry) Assigns defaultAuthSchemeregistry which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuildersetDefaultConnectionConfig(org.apache.http.config.ConnectionConfig config) Assigns defaultConnectionConfig.final HttpAsyncClientBuildersetDefaultCookieSpecRegistry(org.apache.http.config.Lookup<org.apache.http.cookie.CookieSpecProvider> cookieSpecRegistry) Assigns defaultCookieSpecregistry which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuildersetDefaultCookieStore(org.apache.http.client.CookieStore cookieStore) Assigns defaultCookieStoreinstance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuildersetDefaultCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider) Assigns defaultCredentialsProviderinstance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuildersetDefaultHeaders(Collection<? extends org.apache.http.Header> defaultHeaders) Assigns default request header values.final HttpAsyncClientBuildersetDefaultIOReactorConfig(org.apache.http.impl.nio.reactor.IOReactorConfig config) Assigns defaultIOReactorConfig.final HttpAsyncClientBuildersetDefaultRequestConfig(org.apache.http.client.config.RequestConfig config) Assigns defaultRequestConfiginstance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuildersetEventHandler(org.apache.http.nio.NHttpClientEventHandler eventHandler) AssignsNHttpClientEventHandlerinstance.final HttpAsyncClientBuildersetHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier) Deprecated.final HttpAsyncClientBuildersetHttpProcessor(org.apache.http.protocol.HttpProcessor httpprocessor) AssignsHttpProcessorinstance.final HttpAsyncClientBuildersetKeepAliveStrategy(org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy) AssignsConnectionKeepAliveStrategyinstance.final HttpAsyncClientBuildersetMaxConnPerRoute(int maxConnPerRoute) Assigns maximum connection per route value.final HttpAsyncClientBuildersetMaxConnTotal(int maxConnTotal) Assigns maximum total connection value.final HttpAsyncClientBuildersetProxy(org.apache.http.HttpHost proxy) Assigns default proxy value.final HttpAsyncClientBuildersetProxyAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy proxyAuthStrategy) AssignsAuthenticationStrategyinstance for target host authentication.final HttpAsyncClientBuildersetPublicSuffixMatcher(org.apache.http.conn.util.PublicSuffixMatcher publicSuffixMatcher) Assigns file containing public suffix matcher.final HttpAsyncClientBuildersetRedirectStrategy(org.apache.http.client.RedirectStrategy redirectStrategy) AssignsRedirectStrategyinstance.final HttpAsyncClientBuildersetRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner routePlanner) AssignsHttpRoutePlannerinstance.final HttpAsyncClientBuildersetSchemePortResolver(org.apache.http.conn.SchemePortResolver schemePortResolver) AssignsSchemePortResolverinstance.final HttpAsyncClientBuildersetSSLContext(SSLContext sslcontext) AssignsSSLContextinstance.final HttpAsyncClientBuildersetSSLHostnameVerifier(HostnameVerifier hostnameVerifier) AssignsHostnameVerifierinstance.final HttpAsyncClientBuildersetSSLStrategy(SchemeIOSessionStrategy strategy) AssignsSchemeIOSessionStrategyinstance.final HttpAsyncClientBuildersetTargetAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy targetAuthStrategy) AssignsAuthenticationStrategyinstance for proxy authentication.final HttpAsyncClientBuildersetThreadFactory(ThreadFactory threadFactory) AssignsThreadFactoryinstance.final HttpAsyncClientBuildersetUserAgent(String userAgent) AssignsUser-Agentvalue.final HttpAsyncClientBuildersetUserTokenHandler(org.apache.http.client.UserTokenHandler userTokenHandler) AssignsUserTokenHandlerinstance.private static String[]final HttpAsyncClientBuilderUse system properties when creating and configuring default implementations.
-
Field Details
-
connManager
-
schemePortResolver
private org.apache.http.conn.SchemePortResolver schemePortResolver -
sslStrategy
-
hostnameVerifier
-
sslcontext
-
reuseStrategy
private org.apache.http.ConnectionReuseStrategy reuseStrategy -
keepAliveStrategy
private org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy -
targetAuthStrategy
private org.apache.http.client.AuthenticationStrategy targetAuthStrategy -
proxyAuthStrategy
private org.apache.http.client.AuthenticationStrategy proxyAuthStrategy -
userTokenHandler
private org.apache.http.client.UserTokenHandler userTokenHandler -
httpprocessor
private org.apache.http.protocol.HttpProcessor httpprocessor -
requestFirst
-
requestLast
-
responseFirst
-
responseLast
-
routePlanner
private org.apache.http.conn.routing.HttpRoutePlanner routePlanner -
redirectStrategy
private org.apache.http.client.RedirectStrategy redirectStrategy -
authSchemeRegistry
private org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authSchemeRegistry -
cookieSpecRegistry
private org.apache.http.config.Lookup<org.apache.http.cookie.CookieSpecProvider> cookieSpecRegistry -
cookieStore
private org.apache.http.client.CookieStore cookieStore -
credentialsProvider
private org.apache.http.client.CredentialsProvider credentialsProvider -
userAgent
-
proxy
private org.apache.http.HttpHost proxy -
defaultHeaders
-
defaultIOReactorConfig
private org.apache.http.impl.nio.reactor.IOReactorConfig defaultIOReactorConfig -
defaultConnectionConfig
private org.apache.http.config.ConnectionConfig defaultConnectionConfig -
defaultRequestConfig
private org.apache.http.client.config.RequestConfig defaultRequestConfig -
threadFactory
-
eventHandler
private org.apache.http.nio.NHttpClientEventHandler eventHandler -
publicSuffixMatcher
private org.apache.http.conn.util.PublicSuffixMatcher publicSuffixMatcher -
systemProperties
private boolean systemProperties -
cookieManagementDisabled
private boolean cookieManagementDisabled -
authCachingDisabled
private boolean authCachingDisabled -
connectionStateDisabled
private boolean connectionStateDisabled -
maxConnTotal
private int maxConnTotal -
maxConnPerRoute
private int maxConnPerRoute
-
-
Constructor Details
-
HttpAsyncClientBuilder
protected HttpAsyncClientBuilder()
-
-
Method Details
-
create
-
setPublicSuffixMatcher
public final HttpAsyncClientBuilder setPublicSuffixMatcher(org.apache.http.conn.util.PublicSuffixMatcher publicSuffixMatcher) Assigns file containing public suffix matcher. Instances of this class can be created withPublicSuffixMatcherLoader.- Since:
- 4.1
- See Also:
-
setConnectionManager
AssignsNHttpClientConnectionManagerinstance. -
setSchemePortResolver
public final HttpAsyncClientBuilder setSchemePortResolver(org.apache.http.conn.SchemePortResolver schemePortResolver) AssignsSchemePortResolverinstance. -
setMaxConnTotal
Assigns maximum total connection value.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)method. -
setMaxConnPerRoute
Assigns maximum connection per route value.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)method. -
setConnectionReuseStrategy
public final HttpAsyncClientBuilder setConnectionReuseStrategy(org.apache.http.ConnectionReuseStrategy reuseStrategy) AssignsConnectionReuseStrategyinstance. -
setKeepAliveStrategy
public final HttpAsyncClientBuilder setKeepAliveStrategy(org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy) AssignsConnectionKeepAliveStrategyinstance. -
setUserTokenHandler
public final HttpAsyncClientBuilder setUserTokenHandler(org.apache.http.client.UserTokenHandler userTokenHandler) AssignsUserTokenHandlerinstance.Please note this value can be overridden by the
disableConnectionState()method. -
setTargetAuthenticationStrategy
public final HttpAsyncClientBuilder setTargetAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy targetAuthStrategy) AssignsAuthenticationStrategyinstance for proxy authentication. -
setProxyAuthenticationStrategy
public final HttpAsyncClientBuilder setProxyAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy proxyAuthStrategy) AssignsAuthenticationStrategyinstance for target host authentication. -
setHttpProcessor
public final HttpAsyncClientBuilder setHttpProcessor(org.apache.http.protocol.HttpProcessor httpprocessor) AssignsHttpProcessorinstance. -
addInterceptorFirst
public final HttpAsyncClientBuilder addInterceptorFirst(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
addInterceptorLast
public final HttpAsyncClientBuilder addInterceptorLast(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the tail of the protocol processing list.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
addInterceptorFirst
public final HttpAsyncClientBuilder addInterceptorFirst(org.apache.http.HttpRequestInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
addInterceptorLast
Adds this protocol interceptor to the tail of the protocol processing list.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
setRoutePlanner
public final HttpAsyncClientBuilder setRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner routePlanner) AssignsHttpRoutePlannerinstance. -
setRedirectStrategy
public final HttpAsyncClientBuilder setRedirectStrategy(org.apache.http.client.RedirectStrategy redirectStrategy) AssignsRedirectStrategyinstance. -
setDefaultCookieStore
public final HttpAsyncClientBuilder setDefaultCookieStore(org.apache.http.client.CookieStore cookieStore) Assigns defaultCookieStoreinstance which will be used for request execution if not explicitly set in the client execution context. -
setDefaultCredentialsProvider
public final HttpAsyncClientBuilder setDefaultCredentialsProvider(org.apache.http.client.CredentialsProvider credentialsProvider) Assigns defaultCredentialsProviderinstance which will be used for request execution if not explicitly set in the client execution context. -
setDefaultAuthSchemeRegistry
public final HttpAsyncClientBuilder setDefaultAuthSchemeRegistry(org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authSchemeRegistry) Assigns defaultAuthSchemeregistry which will be used for request execution if not explicitly set in the client execution context. -
setDefaultCookieSpecRegistry
public final HttpAsyncClientBuilder setDefaultCookieSpecRegistry(org.apache.http.config.Lookup<org.apache.http.cookie.CookieSpecProvider> cookieSpecRegistry) Assigns defaultCookieSpecregistry which will be used for request execution if not explicitly set in the client execution context. -
setUserAgent
AssignsUser-Agentvalue.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
setProxy
Assigns default proxy value.Please note this value can be overridden by the
setRoutePlanner(org.apache.http.conn.routing.HttpRoutePlanner)method. -
setSSLStrategy
AssignsSchemeIOSessionStrategyinstance.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)method. -
setSSLContext
AssignsSSLContextinstance.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)and thesetSSLStrategy(org.apache.http.nio.conn.SchemeIOSessionStrategy)methods. -
setHostnameVerifier
@Deprecated public final HttpAsyncClientBuilder setHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier) Deprecated.AssignsX509HostnameVerifierinstance.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)and thesetSSLStrategy(org.apache.http.nio.conn.SchemeIOSessionStrategy)methods. -
setSSLHostnameVerifier
AssignsHostnameVerifierinstance.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)and thesetSSLStrategy(org.apache.http.nio.conn.SchemeIOSessionStrategy)methods.- Since:
- 4.1
-
setDefaultHeaders
public final HttpAsyncClientBuilder setDefaultHeaders(Collection<? extends org.apache.http.Header> defaultHeaders) Assigns default request header values.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
setDefaultIOReactorConfig
public final HttpAsyncClientBuilder setDefaultIOReactorConfig(org.apache.http.impl.nio.reactor.IOReactorConfig config) Assigns defaultIOReactorConfig.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)method. -
setDefaultConnectionConfig
public final HttpAsyncClientBuilder setDefaultConnectionConfig(org.apache.http.config.ConnectionConfig config) Assigns defaultConnectionConfig.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)method. -
setDefaultRequestConfig
public final HttpAsyncClientBuilder setDefaultRequestConfig(org.apache.http.client.config.RequestConfig config) Assigns defaultRequestConfiginstance which will be used for request execution if not explicitly set in the client execution context. -
setThreadFactory
AssignsThreadFactoryinstance. -
setEventHandler
public final HttpAsyncClientBuilder setEventHandler(org.apache.http.nio.NHttpClientEventHandler eventHandler) AssignsNHttpClientEventHandlerinstance.- Since:
- 4.1
-
disableConnectionState
Disables connection state tracking. -
disableCookieManagement
Disables state (cookie) management.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
disableAuthCaching
Disables authentication scheme caching.Please note this value can be overridden by the
setHttpProcessor(org.apache.http.protocol.HttpProcessor)method. -
useSystemProperties
Use system properties when creating and configuring default implementations. -
split
-
build
-
setSSLHostnameVerifier(javax.net.ssl.HostnameVerifier)