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 boolean
private org.apache.http.config.Lookup
<org.apache.http.auth.AuthSchemeProvider> private boolean
private NHttpClientConnectionManager
private boolean
private boolean
private org.apache.http.config.Lookup
<org.apache.http.cookie.CookieSpecProvider> private org.apache.http.client.CookieStore
private org.apache.http.client.CredentialsProvider
private org.apache.http.config.ConnectionConfig
private Collection
<? extends org.apache.http.Header> private org.apache.http.impl.nio.reactor.IOReactorConfig
private org.apache.http.client.config.RequestConfig
private org.apache.http.nio.NHttpClientEventHandler
private HostnameVerifier
private org.apache.http.protocol.HttpProcessor
private org.apache.http.conn.ConnectionKeepAliveStrategy
private int
private int
private org.apache.http.HttpHost
private org.apache.http.client.AuthenticationStrategy
private org.apache.http.conn.util.PublicSuffixMatcher
private org.apache.http.client.RedirectStrategy
private 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.ConnectionReuseStrategy
private org.apache.http.conn.routing.HttpRoutePlanner
private org.apache.http.conn.SchemePortResolver
private SSLContext
private SchemeIOSessionStrategy
private boolean
private org.apache.http.client.AuthenticationStrategy
private ThreadFactory
private String
private org.apache.http.client.UserTokenHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal HttpAsyncClientBuilder
addInterceptorFirst
(org.apache.http.HttpRequestInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.final HttpAsyncClientBuilder
addInterceptorFirst
(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the head of the protocol processing list.final HttpAsyncClientBuilder
addInterceptorLast
(org.apache.http.HttpRequestInterceptor itcp) Adds this protocol interceptor to the tail of the protocol processing list.final HttpAsyncClientBuilder
addInterceptorLast
(org.apache.http.HttpResponseInterceptor itcp) Adds this protocol interceptor to the tail of the protocol processing list.build()
static HttpAsyncClientBuilder
create()
final HttpAsyncClientBuilder
Disables authentication scheme caching.final HttpAsyncClientBuilder
Disables connection state tracking.final HttpAsyncClientBuilder
Disables state (cookie) management.final HttpAsyncClientBuilder
setConnectionManager
(NHttpClientConnectionManager connManager) AssignsNHttpClientConnectionManager
instance.final HttpAsyncClientBuilder
setConnectionManagerShared
(boolean shared) Defines the connection manager is to be shared by multiple client instances.final HttpAsyncClientBuilder
setConnectionReuseStrategy
(org.apache.http.ConnectionReuseStrategy reuseStrategy) AssignsConnectionReuseStrategy
instance.final HttpAsyncClientBuilder
setDefaultAuthSchemeRegistry
(org.apache.http.config.Lookup<org.apache.http.auth.AuthSchemeProvider> authSchemeRegistry) Assigns defaultAuthScheme
registry which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuilder
setDefaultConnectionConfig
(org.apache.http.config.ConnectionConfig config) Assigns defaultConnectionConfig
.final HttpAsyncClientBuilder
setDefaultCookieSpecRegistry
(org.apache.http.config.Lookup<org.apache.http.cookie.CookieSpecProvider> cookieSpecRegistry) Assigns defaultCookieSpec
registry which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuilder
setDefaultCookieStore
(org.apache.http.client.CookieStore cookieStore) Assigns defaultCookieStore
instance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuilder
setDefaultCredentialsProvider
(org.apache.http.client.CredentialsProvider credentialsProvider) Assigns defaultCredentialsProvider
instance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuilder
setDefaultHeaders
(Collection<? extends org.apache.http.Header> defaultHeaders) Assigns default request header values.final HttpAsyncClientBuilder
setDefaultIOReactorConfig
(org.apache.http.impl.nio.reactor.IOReactorConfig config) Assigns defaultIOReactorConfig
.final HttpAsyncClientBuilder
setDefaultRequestConfig
(org.apache.http.client.config.RequestConfig config) Assigns defaultRequestConfig
instance which will be used for request execution if not explicitly set in the client execution context.final HttpAsyncClientBuilder
setEventHandler
(org.apache.http.nio.NHttpClientEventHandler eventHandler) AssignsNHttpClientEventHandler
instance.final HttpAsyncClientBuilder
setHostnameVerifier
(org.apache.http.conn.ssl.X509HostnameVerifier hostnameVerifier) Deprecated.final HttpAsyncClientBuilder
setHttpProcessor
(org.apache.http.protocol.HttpProcessor httpprocessor) AssignsHttpProcessor
instance.final HttpAsyncClientBuilder
setKeepAliveStrategy
(org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy) AssignsConnectionKeepAliveStrategy
instance.final HttpAsyncClientBuilder
setMaxConnPerRoute
(int maxConnPerRoute) Assigns maximum connection per route value.final HttpAsyncClientBuilder
setMaxConnTotal
(int maxConnTotal) Assigns maximum total connection value.final HttpAsyncClientBuilder
setProxy
(org.apache.http.HttpHost proxy) Assigns default proxy value.final HttpAsyncClientBuilder
setProxyAuthenticationStrategy
(org.apache.http.client.AuthenticationStrategy proxyAuthStrategy) AssignsAuthenticationStrategy
instance for target host authentication.final HttpAsyncClientBuilder
setPublicSuffixMatcher
(org.apache.http.conn.util.PublicSuffixMatcher publicSuffixMatcher) Assigns file containing public suffix matcher.final HttpAsyncClientBuilder
setRedirectStrategy
(org.apache.http.client.RedirectStrategy redirectStrategy) AssignsRedirectStrategy
instance.final HttpAsyncClientBuilder
setRoutePlanner
(org.apache.http.conn.routing.HttpRoutePlanner routePlanner) AssignsHttpRoutePlanner
instance.final HttpAsyncClientBuilder
setSchemePortResolver
(org.apache.http.conn.SchemePortResolver schemePortResolver) AssignsSchemePortResolver
instance.final HttpAsyncClientBuilder
setSSLContext
(SSLContext sslcontext) AssignsSSLContext
instance.final HttpAsyncClientBuilder
setSSLHostnameVerifier
(HostnameVerifier hostnameVerifier) AssignsHostnameVerifier
instance.final HttpAsyncClientBuilder
setSSLStrategy
(SchemeIOSessionStrategy strategy) AssignsSchemeIOSessionStrategy
instance.final HttpAsyncClientBuilder
setTargetAuthenticationStrategy
(org.apache.http.client.AuthenticationStrategy targetAuthStrategy) AssignsAuthenticationStrategy
instance for proxy authentication.final HttpAsyncClientBuilder
setThreadFactory
(ThreadFactory threadFactory) AssignsThreadFactory
instance.final HttpAsyncClientBuilder
setUserAgent
(String userAgent) AssignsUser-Agent
value.final HttpAsyncClientBuilder
setUserTokenHandler
(org.apache.http.client.UserTokenHandler userTokenHandler) AssignsUserTokenHandler
instance.private static String[]
final HttpAsyncClientBuilder
Use 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
AssignsNHttpClientConnectionManager
instance. -
setSchemePortResolver
public final HttpAsyncClientBuilder setSchemePortResolver(org.apache.http.conn.SchemePortResolver schemePortResolver) AssignsSchemePortResolver
instance. -
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) AssignsConnectionReuseStrategy
instance. -
setKeepAliveStrategy
public final HttpAsyncClientBuilder setKeepAliveStrategy(org.apache.http.conn.ConnectionKeepAliveStrategy keepAliveStrategy) AssignsConnectionKeepAliveStrategy
instance. -
setUserTokenHandler
public final HttpAsyncClientBuilder setUserTokenHandler(org.apache.http.client.UserTokenHandler userTokenHandler) AssignsUserTokenHandler
instance.Please note this value can be overridden by the
disableConnectionState()
method. -
setTargetAuthenticationStrategy
public final HttpAsyncClientBuilder setTargetAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy targetAuthStrategy) AssignsAuthenticationStrategy
instance for proxy authentication. -
setProxyAuthenticationStrategy
public final HttpAsyncClientBuilder setProxyAuthenticationStrategy(org.apache.http.client.AuthenticationStrategy proxyAuthStrategy) AssignsAuthenticationStrategy
instance for target host authentication. -
setHttpProcessor
public final HttpAsyncClientBuilder setHttpProcessor(org.apache.http.protocol.HttpProcessor httpprocessor) AssignsHttpProcessor
instance. -
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) AssignsHttpRoutePlanner
instance. -
setRedirectStrategy
public final HttpAsyncClientBuilder setRedirectStrategy(org.apache.http.client.RedirectStrategy redirectStrategy) AssignsRedirectStrategy
instance. -
setDefaultCookieStore
public final HttpAsyncClientBuilder setDefaultCookieStore(org.apache.http.client.CookieStore cookieStore) Assigns defaultCookieStore
instance 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 defaultCredentialsProvider
instance 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 defaultAuthScheme
registry 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 defaultCookieSpec
registry which will be used for request execution if not explicitly set in the client execution context. -
setUserAgent
AssignsUser-Agent
value.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
AssignsSchemeIOSessionStrategy
instance.Please note this value can be overridden by the
setConnectionManager(org.apache.http.nio.conn.NHttpClientConnectionManager)
method. -
setSSLContext
AssignsSSLContext
instance.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.AssignsX509HostnameVerifier
instance.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
AssignsHostnameVerifier
instance.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 defaultRequestConfig
instance which will be used for request execution if not explicitly set in the client execution context. -
setThreadFactory
AssignsThreadFactory
instance. -
setEventHandler
public final HttpAsyncClientBuilder setEventHandler(org.apache.http.nio.NHttpClientEventHandler eventHandler) AssignsNHttpClientEventHandler
instance.- 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)