Class HttpAsyncClientBuilder
- java.lang.Object
-
- org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder
-
- Direct Known Subclasses:
CachingHttpAsyncClientBuilder
public class HttpAsyncClientBuilder extends java.lang.Object
Builder forCloseableHttpAsyncClient
instances that can negotiate the most optimal HTTP protocol version during theTLS
handshake withALPN
extension if supported by the Java runtime.Concurrent message exchanges executed by
CloseableHttpAsyncClient
instances created with this builder will get automatically assigned to separate connections leased from the connection pool.When a particular component is not explicitly set 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 callingbuild()
.- http.proxyHost
- http.proxyPort
- https.proxyHost
- https.proxyPort
- http.nonProxyHosts
- http.keepAlive
- http.agent
Please note that some settings used by this class can be mutually exclusive and may not apply when building
CloseableHttpAsyncClient
instances.- Since:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HttpAsyncClientBuilder.ExecInterceptorEntry
private static class
HttpAsyncClientBuilder.RequestInterceptorEntry
private static class
HttpAsyncClientBuilder.ResponseInterceptorEntry
-
Field Summary
Fields Modifier and Type Field Description private boolean
authCachingDisabled
private org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory>
authSchemeRegistry
private boolean
automaticRetriesDisabled
private org.apache.hc.core5.http.config.CharCodingConfig
charCodingConfig
private java.util.List<java.io.Closeable>
closeables
private boolean
connectionStateDisabled
private AsyncClientConnectionManager
connManager
private boolean
connManagerShared
private boolean
cookieManagementDisabled
private org.apache.hc.core5.http.config.Lookup<CookieSpecFactory>
cookieSpecRegistry
private CookieStore
cookieStore
private CredentialsProvider
credentialsProvider
private java.util.Collection<? extends org.apache.hc.core5.http.Header>
defaultHeaders
private RequestConfig
defaultRequestConfig
private boolean
evictExpiredConnections
private boolean
evictIdleConnections
private java.util.LinkedList<HttpAsyncClientBuilder.ExecInterceptorEntry>
execInterceptors
private org.apache.hc.core5.http.config.Http1Config
h1Config
private org.apache.hc.core5.http2.config.H2Config
h2Config
private org.apache.hc.core5.reactor.IOReactorConfig
ioReactorConfig
private org.apache.hc.core5.function.Callback<java.lang.Exception>
ioReactorExceptionCallback
private org.apache.hc.core5.function.Decorator<org.apache.hc.core5.reactor.IOSession>
ioSessionDecorator
private org.apache.hc.core5.reactor.IOSessionListener
ioSessionListener
private ConnectionKeepAliveStrategy
keepAliveStrategy
private org.apache.hc.core5.util.TimeValue
maxIdleTime
private org.apache.hc.core5.http.HttpHost
proxy
private AuthenticationStrategy
proxyAuthStrategy
private java.net.ProxySelector
proxySelector
private boolean
redirectHandlingDisabled
private RedirectStrategy
redirectStrategy
private java.util.LinkedList<HttpAsyncClientBuilder.RequestInterceptorEntry>
requestInterceptors
private java.util.LinkedList<HttpAsyncClientBuilder.ResponseInterceptorEntry>
responseInterceptors
private HttpRequestRetryStrategy
retryStrategy
private org.apache.hc.core5.http.ConnectionReuseStrategy
reuseStrategy
private HttpRoutePlanner
routePlanner
private SchemePortResolver
schemePortResolver
private boolean
systemProperties
private AuthenticationStrategy
targetAuthStrategy
private java.util.concurrent.ThreadFactory
threadFactory
private TlsConfig
tlsConfig
Deprecated.TLS should be configured by the connection managerprivate java.lang.String
userAgent
private UserTokenHandler
userTokenHandler
-
Constructor Summary
Constructors Modifier Constructor Description protected
HttpAsyncClientBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addCloseable(java.io.Closeable closeable)
Adds to the list ofCloseable
resources to be managed by the client.HttpAsyncClientBuilder
addExecInterceptorAfter(java.lang.String existing, java.lang.String name, AsyncExecChainHandler interceptor)
Adds this execution interceptor after interceptor with the given name.HttpAsyncClientBuilder
addExecInterceptorBefore(java.lang.String existing, java.lang.String name, AsyncExecChainHandler interceptor)
Adds this execution interceptor before an existing interceptor.HttpAsyncClientBuilder
addExecInterceptorFirst(java.lang.String name, AsyncExecChainHandler interceptor)
Add an interceptor to the head of the processing list.HttpAsyncClientBuilder
addExecInterceptorLast(java.lang.String name, AsyncExecChainHandler interceptor)
Add an interceptor to the tail of the processing list.HttpAsyncClientBuilder
addRequestInterceptorFirst(org.apache.hc.core5.http.HttpRequestInterceptor interceptor)
Adds this protocol interceptor to the head of the protocol processing list.HttpAsyncClientBuilder
addRequestInterceptorLast(org.apache.hc.core5.http.HttpRequestInterceptor interceptor)
Adds this protocol interceptor to the tail of the protocol processing list.HttpAsyncClientBuilder
addResponseInterceptorFirst(org.apache.hc.core5.http.HttpResponseInterceptor interceptor)
Adds this protocol interceptor to the head of the protocol processing list.HttpAsyncClientBuilder
addResponseInterceptorLast(org.apache.hc.core5.http.HttpResponseInterceptor interceptor)
Adds this protocol interceptor to the tail of the protocol processing list.CloseableHttpAsyncClient
build()
static HttpAsyncClientBuilder
create()
protected void
customizeExecChain(org.apache.hc.core5.http.config.NamedElementChain<AsyncExecChainHandler> execChainDefinition)
Request exec chain customization and extension.HttpAsyncClientBuilder
disableAuthCaching()
Disables authentication scheme caching.HttpAsyncClientBuilder
disableAutomaticRetries()
Disables automatic request recovery and re-execution.HttpAsyncClientBuilder
disableConnectionState()
Disables connection state tracking.HttpAsyncClientBuilder
disableCookieManagement()
Disables state (cookie) management.HttpAsyncClientBuilder
disableRedirectHandling()
Disables automatic redirect handling.HttpAsyncClientBuilder
evictExpiredConnections()
Makes this instance of HttpClient proactively evict expired connections from the connection pool using a background thread.HttpAsyncClientBuilder
evictIdleConnections(org.apache.hc.core5.util.TimeValue maxIdleTime)
Makes this instance of HttpClient proactively evict idle connections from the connection pool using a background thread.private java.lang.String
getProperty(java.lang.String key, java.lang.String defaultValue)
HttpAsyncClientBuilder
replaceExecInterceptor(java.lang.String existing, AsyncExecChainHandler interceptor)
Replace an existing interceptor with the given name with new interceptor.HttpAsyncClientBuilder
setCharCodingConfig(org.apache.hc.core5.http.config.CharCodingConfig charCodingConfig)
SetsCharCodingConfig
configuration.HttpAsyncClientBuilder
setConnectionManager(AsyncClientConnectionManager connManager)
AssignsAsyncClientConnectionManager
instance.HttpAsyncClientBuilder
setConnectionManagerShared(boolean shared)
Defines the connection manager is to be shared by multiple client instances.HttpAsyncClientBuilder
setConnectionReuseStrategy(org.apache.hc.core5.http.ConnectionReuseStrategy reuseStrategy)
AssignsConnectionReuseStrategy
instance.HttpAsyncClientBuilder
setDefaultAuthSchemeRegistry(org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> authSchemeRegistry)
Assigns defaultAuthScheme
registry which will be used for request execution if not explicitly set in the client execution context.HttpAsyncClientBuilder
setDefaultCookieSpecRegistry(org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> cookieSpecRegistry)
Assigns defaultCookieSpec
registry which will be used for request execution if not explicitly set in the client execution context.HttpAsyncClientBuilder
setDefaultCookieStore(CookieStore cookieStore)
Assigns defaultCookieStore
instance which will be used for request execution if not explicitly set in the client execution context.HttpAsyncClientBuilder
setDefaultCredentialsProvider(CredentialsProvider credentialsProvider)
Assigns defaultCredentialsProvider
instance which will be used for request execution if not explicitly set in the client execution context.HttpAsyncClientBuilder
setDefaultHeaders(java.util.Collection<? extends org.apache.hc.core5.http.Header> defaultHeaders)
Assigns default request header values.HttpAsyncClientBuilder
setDefaultRequestConfig(RequestConfig config)
Assigns defaultRequestConfig
instance which will be used for request execution if not explicitly set in the client execution context.HttpAsyncClientBuilder
setH2Config(org.apache.hc.core5.http2.config.H2Config h2Config)
SetsH2Config
configuration.HttpAsyncClientBuilder
setHttp1Config(org.apache.hc.core5.http.config.Http1Config h1Config)
SetsHttp1Config
configuration.HttpAsyncClientBuilder
setIOReactorConfig(org.apache.hc.core5.reactor.IOReactorConfig ioReactorConfig)
SetsIOReactorConfig
configuration.HttpAsyncClientBuilder
setIoReactorExceptionCallback(org.apache.hc.core5.function.Callback<java.lang.Exception> ioReactorExceptionCallback)
Sets the callback that will be invoked when the client's IOReactor encounters an uncaught exception.HttpAsyncClientBuilder
setIoSessionDecorator(org.apache.hc.core5.function.Decorator<org.apache.hc.core5.reactor.IOSession> ioSessionDecorator)
Sets theIOSession
Decorator
that will be use with the client's IOReactor.HttpAsyncClientBuilder
setIOSessionListener(org.apache.hc.core5.reactor.IOSessionListener ioSessionListener)
SetsIOSessionListener
listener.HttpAsyncClientBuilder
setKeepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
AssignsConnectionKeepAliveStrategy
instance.HttpAsyncClientBuilder
setProxy(org.apache.hc.core5.http.HttpHost proxy)
Assigns default proxy value.HttpAsyncClientBuilder
setProxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
AssignsAuthenticationStrategy
instance for proxy authentication.HttpAsyncClientBuilder
setProxySelector(java.net.ProxySelector proxySelector)
Sets theProxySelector
that will be used to select the proxies to be used for establishing HTTP connections.HttpAsyncClientBuilder
setRedirectStrategy(RedirectStrategy redirectStrategy)
AssignsRedirectStrategy
instance.HttpAsyncClientBuilder
setRetryStrategy(HttpRequestRetryStrategy retryStrategy)
AssignsHttpRequestRetryStrategy
instance.HttpAsyncClientBuilder
setRoutePlanner(HttpRoutePlanner routePlanner)
AssignsHttpRoutePlanner
instance.HttpAsyncClientBuilder
setSchemePortResolver(SchemePortResolver schemePortResolver)
AssignsSchemePortResolver
instance.HttpAsyncClientBuilder
setTargetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
AssignsAuthenticationStrategy
instance for target host authentication.HttpAsyncClientBuilder
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
AssignsThreadFactory
instance.HttpAsyncClientBuilder
setUserAgent(java.lang.String userAgent)
AssignsUser-Agent
value.HttpAsyncClientBuilder
setUserTokenHandler(UserTokenHandler userTokenHandler)
AssignsUserTokenHandler
instance.HttpAsyncClientBuilder
setVersionPolicy(org.apache.hc.core5.http2.HttpVersionPolicy versionPolicy)
Deprecated.UseTlsConfig
and connection manager methodsHttpAsyncClientBuilder
useSystemProperties()
Use system properties when creating and configuring default implementations.
-
-
-
Field Detail
-
tlsConfig
@Deprecated private TlsConfig tlsConfig
Deprecated.TLS should be configured by the connection manager
-
connManager
private AsyncClientConnectionManager connManager
-
connManagerShared
private boolean connManagerShared
-
ioReactorConfig
private org.apache.hc.core5.reactor.IOReactorConfig ioReactorConfig
-
ioSessionListener
private org.apache.hc.core5.reactor.IOSessionListener ioSessionListener
-
ioReactorExceptionCallback
private org.apache.hc.core5.function.Callback<java.lang.Exception> ioReactorExceptionCallback
-
h1Config
private org.apache.hc.core5.http.config.Http1Config h1Config
-
h2Config
private org.apache.hc.core5.http2.config.H2Config h2Config
-
charCodingConfig
private org.apache.hc.core5.http.config.CharCodingConfig charCodingConfig
-
schemePortResolver
private SchemePortResolver schemePortResolver
-
keepAliveStrategy
private ConnectionKeepAliveStrategy keepAliveStrategy
-
userTokenHandler
private UserTokenHandler userTokenHandler
-
targetAuthStrategy
private AuthenticationStrategy targetAuthStrategy
-
proxyAuthStrategy
private AuthenticationStrategy proxyAuthStrategy
-
ioSessionDecorator
private org.apache.hc.core5.function.Decorator<org.apache.hc.core5.reactor.IOSession> ioSessionDecorator
-
requestInterceptors
private java.util.LinkedList<HttpAsyncClientBuilder.RequestInterceptorEntry> requestInterceptors
-
responseInterceptors
private java.util.LinkedList<HttpAsyncClientBuilder.ResponseInterceptorEntry> responseInterceptors
-
execInterceptors
private java.util.LinkedList<HttpAsyncClientBuilder.ExecInterceptorEntry> execInterceptors
-
routePlanner
private HttpRoutePlanner routePlanner
-
redirectStrategy
private RedirectStrategy redirectStrategy
-
retryStrategy
private HttpRequestRetryStrategy retryStrategy
-
reuseStrategy
private org.apache.hc.core5.http.ConnectionReuseStrategy reuseStrategy
-
authSchemeRegistry
private org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> authSchemeRegistry
-
cookieSpecRegistry
private org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> cookieSpecRegistry
-
cookieStore
private CookieStore cookieStore
-
credentialsProvider
private CredentialsProvider credentialsProvider
-
userAgent
private java.lang.String userAgent
-
proxy
private org.apache.hc.core5.http.HttpHost proxy
-
defaultHeaders
private java.util.Collection<? extends org.apache.hc.core5.http.Header> defaultHeaders
-
defaultRequestConfig
private RequestConfig defaultRequestConfig
-
evictExpiredConnections
private boolean evictExpiredConnections
-
evictIdleConnections
private boolean evictIdleConnections
-
maxIdleTime
private org.apache.hc.core5.util.TimeValue maxIdleTime
-
systemProperties
private boolean systemProperties
-
automaticRetriesDisabled
private boolean automaticRetriesDisabled
-
redirectHandlingDisabled
private boolean redirectHandlingDisabled
-
cookieManagementDisabled
private boolean cookieManagementDisabled
-
authCachingDisabled
private boolean authCachingDisabled
-
connectionStateDisabled
private boolean connectionStateDisabled
-
threadFactory
private java.util.concurrent.ThreadFactory threadFactory
-
closeables
private java.util.List<java.io.Closeable> closeables
-
proxySelector
private java.net.ProxySelector proxySelector
-
-
Method Detail
-
create
public static HttpAsyncClientBuilder create()
-
setVersionPolicy
@Deprecated public final HttpAsyncClientBuilder setVersionPolicy(org.apache.hc.core5.http2.HttpVersionPolicy versionPolicy)
Deprecated.UseTlsConfig
and connection manager methodsSets HTTP protocol version policy.
-
setHttp1Config
public final HttpAsyncClientBuilder setHttp1Config(org.apache.hc.core5.http.config.Http1Config h1Config)
SetsHttp1Config
configuration.
-
setH2Config
public final HttpAsyncClientBuilder setH2Config(org.apache.hc.core5.http2.config.H2Config h2Config)
SetsH2Config
configuration.
-
setConnectionManager
public final HttpAsyncClientBuilder setConnectionManager(AsyncClientConnectionManager connManager)
AssignsAsyncClientConnectionManager
instance.
-
setConnectionManagerShared
public final HttpAsyncClientBuilder setConnectionManagerShared(boolean shared)
Defines the connection manager is to be shared by multiple client instances.If the connection manager is shared its life-cycle is expected to be managed by the caller and it will not be shut down if the client is closed.
- Parameters:
shared
- defines whether or not the connection manager can be shared by multiple clients.
-
setIOReactorConfig
public final HttpAsyncClientBuilder setIOReactorConfig(org.apache.hc.core5.reactor.IOReactorConfig ioReactorConfig)
SetsIOReactorConfig
configuration.
-
setIOSessionListener
public final HttpAsyncClientBuilder setIOSessionListener(org.apache.hc.core5.reactor.IOSessionListener ioSessionListener)
SetsIOSessionListener
listener.- Since:
- 5.2
-
setIoReactorExceptionCallback
public final HttpAsyncClientBuilder setIoReactorExceptionCallback(org.apache.hc.core5.function.Callback<java.lang.Exception> ioReactorExceptionCallback)
Sets the callback that will be invoked when the client's IOReactor encounters an uncaught exception.- Since:
- 5.1
-
setCharCodingConfig
public final HttpAsyncClientBuilder setCharCodingConfig(org.apache.hc.core5.http.config.CharCodingConfig charCodingConfig)
SetsCharCodingConfig
configuration.
-
setConnectionReuseStrategy
public final HttpAsyncClientBuilder setConnectionReuseStrategy(org.apache.hc.core5.http.ConnectionReuseStrategy reuseStrategy)
AssignsConnectionReuseStrategy
instance.Please note this strategy applies to HTTP/1.0 and HTTP/1.1 connections only
-
setKeepAliveStrategy
public final HttpAsyncClientBuilder setKeepAliveStrategy(ConnectionKeepAliveStrategy keepAliveStrategy)
AssignsConnectionKeepAliveStrategy
instance.
-
setUserTokenHandler
public final HttpAsyncClientBuilder setUserTokenHandler(UserTokenHandler userTokenHandler)
AssignsUserTokenHandler
instance.Please note this value can be overridden by the
disableConnectionState()
method.
-
setTargetAuthenticationStrategy
public final HttpAsyncClientBuilder setTargetAuthenticationStrategy(AuthenticationStrategy targetAuthStrategy)
AssignsAuthenticationStrategy
instance for target host authentication.
-
setProxyAuthenticationStrategy
public final HttpAsyncClientBuilder setProxyAuthenticationStrategy(AuthenticationStrategy proxyAuthStrategy)
AssignsAuthenticationStrategy
instance for proxy authentication.
-
setIoSessionDecorator
public final HttpAsyncClientBuilder setIoSessionDecorator(org.apache.hc.core5.function.Decorator<org.apache.hc.core5.reactor.IOSession> ioSessionDecorator)
Sets theIOSession
Decorator
that will be use with the client's IOReactor.- Since:
- 5.2
-
addResponseInterceptorFirst
public final HttpAsyncClientBuilder addResponseInterceptorFirst(org.apache.hc.core5.http.HttpResponseInterceptor interceptor)
Adds this protocol interceptor to the head of the protocol processing list.
-
addResponseInterceptorLast
public final HttpAsyncClientBuilder addResponseInterceptorLast(org.apache.hc.core5.http.HttpResponseInterceptor interceptor)
Adds this protocol interceptor to the tail of the protocol processing list.
-
addExecInterceptorBefore
public final HttpAsyncClientBuilder addExecInterceptorBefore(java.lang.String existing, java.lang.String name, AsyncExecChainHandler interceptor)
Adds this execution interceptor before an existing interceptor.
-
addExecInterceptorAfter
public final HttpAsyncClientBuilder addExecInterceptorAfter(java.lang.String existing, java.lang.String name, AsyncExecChainHandler interceptor)
Adds this execution interceptor after interceptor with the given name.
-
replaceExecInterceptor
public final HttpAsyncClientBuilder replaceExecInterceptor(java.lang.String existing, AsyncExecChainHandler interceptor)
Replace an existing interceptor with the given name with new interceptor.
-
addExecInterceptorFirst
public final HttpAsyncClientBuilder addExecInterceptorFirst(java.lang.String name, AsyncExecChainHandler interceptor)
Add an interceptor to the head of the processing list.
-
addExecInterceptorLast
public final HttpAsyncClientBuilder addExecInterceptorLast(java.lang.String name, AsyncExecChainHandler interceptor)
Add an interceptor to the tail of the processing list.
-
addRequestInterceptorFirst
public final HttpAsyncClientBuilder addRequestInterceptorFirst(org.apache.hc.core5.http.HttpRequestInterceptor interceptor)
Adds this protocol interceptor to the head of the protocol processing list.
-
addRequestInterceptorLast
public final HttpAsyncClientBuilder addRequestInterceptorLast(org.apache.hc.core5.http.HttpRequestInterceptor interceptor)
Adds this protocol interceptor to the tail of the protocol processing list.
-
setRetryStrategy
public final HttpAsyncClientBuilder setRetryStrategy(HttpRequestRetryStrategy retryStrategy)
AssignsHttpRequestRetryStrategy
instance.Please note this value can be overridden by the
disableAutomaticRetries()
method.
-
setRedirectStrategy
public HttpAsyncClientBuilder setRedirectStrategy(RedirectStrategy redirectStrategy)
AssignsRedirectStrategy
instance.Please note this value can be overridden by the
disableRedirectHandling()
method.
-
setSchemePortResolver
public final HttpAsyncClientBuilder setSchemePortResolver(SchemePortResolver schemePortResolver)
AssignsSchemePortResolver
instance.
-
setThreadFactory
public final HttpAsyncClientBuilder setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
AssignsThreadFactory
instance.
-
setUserAgent
public final HttpAsyncClientBuilder setUserAgent(java.lang.String userAgent)
AssignsUser-Agent
value.
-
setDefaultHeaders
public final HttpAsyncClientBuilder setDefaultHeaders(java.util.Collection<? extends org.apache.hc.core5.http.Header> defaultHeaders)
Assigns default request header values.
-
setProxySelector
public final HttpAsyncClientBuilder setProxySelector(java.net.ProxySelector proxySelector)
Sets theProxySelector
that will be used to select the proxies to be used for establishing HTTP connections. If a non-null proxy selector is set, it will take precedence over the proxy settings configured in the client.- Parameters:
proxySelector
- theProxySelector
to be used, or null to use the default system proxy selector.- Returns:
- this
HttpAsyncClientBuilder
instance, to allow for method chaining.
-
setProxy
public final HttpAsyncClientBuilder setProxy(org.apache.hc.core5.http.HttpHost proxy)
Assigns default proxy value.Please note this value can be overridden by the
setRoutePlanner( HttpRoutePlanner)
method.
-
setRoutePlanner
public final HttpAsyncClientBuilder setRoutePlanner(HttpRoutePlanner routePlanner)
AssignsHttpRoutePlanner
instance.
-
setDefaultCredentialsProvider
public final HttpAsyncClientBuilder setDefaultCredentialsProvider(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.hc.core5.http.config.Lookup<AuthSchemeFactory> 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.hc.core5.http.config.Lookup<CookieSpecFactory> cookieSpecRegistry)
Assigns defaultCookieSpec
registry which will be used for request execution if not explicitly set in the client execution context.
-
setDefaultCookieStore
public final HttpAsyncClientBuilder setDefaultCookieStore(CookieStore cookieStore)
Assigns defaultCookieStore
instance which will be used for request execution if not explicitly set in the client execution context.
-
setDefaultRequestConfig
public final HttpAsyncClientBuilder setDefaultRequestConfig(RequestConfig config)
Assigns defaultRequestConfig
instance which will be used for request execution if not explicitly set in the client execution context.
-
useSystemProperties
public final HttpAsyncClientBuilder useSystemProperties()
Use system properties when creating and configuring default implementations.
-
disableConnectionState
public final HttpAsyncClientBuilder disableConnectionState()
Disables connection state tracking.
-
disableRedirectHandling
public final HttpAsyncClientBuilder disableRedirectHandling()
Disables automatic redirect handling.
-
disableAutomaticRetries
public final HttpAsyncClientBuilder disableAutomaticRetries()
Disables automatic request recovery and re-execution.
-
disableCookieManagement
public final HttpAsyncClientBuilder disableCookieManagement()
Disables state (cookie) management.
-
disableAuthCaching
public final HttpAsyncClientBuilder disableAuthCaching()
Disables authentication scheme caching.
-
evictExpiredConnections
public final HttpAsyncClientBuilder evictExpiredConnections()
Makes this instance of HttpClient proactively evict expired connections from the connection pool using a background thread.One MUST explicitly close HttpClient with
Closeable.close()
in order to stop and release the background thread.Please note this method has no effect if the instance of HttpClient is configured to use a shared connection manager.
- See Also:
setConnectionManagerShared(boolean)
,ConnPoolControl.closeExpired()
-
evictIdleConnections
public final HttpAsyncClientBuilder evictIdleConnections(org.apache.hc.core5.util.TimeValue maxIdleTime)
Makes this instance of HttpClient proactively evict idle connections from the connection pool using a background thread.One MUST explicitly close HttpClient with
Closeable.close()
in order to stop and release the background thread.Please note this method has no effect if the instance of HttpClient is configured to use a shared connection manager.
- Parameters:
maxIdleTime
- maximum time persistent connections can stay idle while kept alive in the connection pool. Connections whose inactivity period exceeds this value will get closed and evicted from the pool.- See Also:
setConnectionManagerShared(boolean)
,ConnPoolControl.closeIdle(TimeValue)
-
customizeExecChain
@Internal protected void customizeExecChain(org.apache.hc.core5.http.config.NamedElementChain<AsyncExecChainHandler> execChainDefinition)
Request exec chain customization and extension.For internal use.
-
addCloseable
@Internal protected void addCloseable(java.io.Closeable closeable)
Adds to the list ofCloseable
resources to be managed by the client.For internal use.
-
build
public CloseableHttpAsyncClient build()
-
getProperty
private java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
-
-