Package org.asynchttpclient
Class DefaultAsyncHttpClientConfig
- java.lang.Object
-
- org.asynchttpclient.DefaultAsyncHttpClientConfig
-
- All Implemented Interfaces:
AsyncHttpClientConfig
public class DefaultAsyncHttpClientConfig extends Object implements AsyncHttpClientConfig
Configuration class to use with aAsyncHttpClient
. System property can be also used to configure this object default behavior by doing:
-Dorg.asynchttpclient.nameOfTheProperty- See Also:
for documentation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultAsyncHttpClientConfig.Builder
Builder for anAsyncHttpClient
-
Nested classes/interfaces inherited from interface org.asynchttpclient.AsyncHttpClientConfig
AsyncHttpClientConfig.ResponseBodyPartFactory
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
expiredCookieEvictionDelay()
Return the delay in milliseconds to evict expired cookies from CookieStoreint
getAcquireFreeChannelTimeout()
Return the maximum duration in milliseconds anAsyncHttpClient
can wait to acquire a free channelString
getAhcVersion()
io.netty.buffer.ByteBufAllocator
getAllocator()
Map<io.netty.channel.ChannelOption<Object>,Object>
getChannelOptions()
ChannelPool
getChannelPool()
int
getChunkedFileChunkSize()
int
getConnectionPoolCleanerPeriod()
ConnectionSemaphoreFactory
getConnectionSemaphoreFactory()
int
getConnectionTtl()
int
getConnectTimeout()
Return the maximum time in millisecond anAsyncHttpClient
can wait when connecting to a remote hostCookieStore
getCookieStore()
Return cookie store that is used to store and retrieve cookiesString[]
getEnabledCipherSuites()
String[]
getEnabledProtocols()
io.netty.channel.EventLoopGroup
getEventLoopGroup()
int
getHandshakeTimeout()
int
getHashedWheelTimerSize()
long
getHashedWheelTimerTickDuration()
Consumer<io.netty.channel.Channel>
getHttpAdditionalChannelInitializer()
int
getHttpClientCodecInitialBufferSize()
int
getHttpClientCodecMaxChunkSize()
int
getHttpClientCodecMaxHeaderSize()
int
getHttpClientCodecMaxInitialLineLength()
List<IOExceptionFilter>
getIoExceptionFilters()
Return the list ofIOException
int
getIoThreadsCount()
KeepAliveStrategy
getKeepAliveStrategy()
int
getMaxConnections()
Return the maximum number of connections anAsyncHttpClient
can handle.int
getMaxConnectionsPerHost()
Return the maximum number of connections per hosts anAsyncHttpClient
can handle.int
getMaxRedirects()
Get the maximum number of HTTP redirectint
getMaxRequestRetry()
Return the number of time the library will retry when anIOException
is throw by the remote serverio.netty.util.Timer
getNettyTimer()
int
getPooledConnectionIdleTimeout()
Return the maximum time in millisecond anAsyncHttpClient
will keep connection in pool.ProxyServerSelector
getProxyServerSelector()
An instance ofProxyServer
used by anAsyncHttpClient
int
getReadTimeout()
Return the maximum time in millisecond anAsyncHttpClient
can stay idle.Realm
getRealm()
Return the currentRealm
List<RequestFilter>
getRequestFilters()
Return the list ofRequestFilter
int
getRequestTimeout()
Return the maximum time in millisecond anAsyncHttpClient
waits until the response is completed.AsyncHttpClientConfig.ResponseBodyPartFactory
getResponseBodyPartFactory()
List<ResponseFilter>
getResponseFilters()
Return the list ofResponseFilter
int
getShutdownQuietPeriod()
int
getShutdownTimeout()
int
getSoLinger()
int
getSoRcvBuf()
int
getSoSndBuf()
io.netty.handler.ssl.SslContext
getSslContext()
Return an instance ofSslContext
used for SSL connection.SslEngineFactory
getSslEngineFactory()
int
getSslSessionCacheSize()
int
getSslSessionTimeout()
ThreadFactory
getThreadFactory()
Return theThreadFactory
anAsyncHttpClient
use for handling asynchronous response.String
getThreadPoolName()
Return the name ofAsyncHttpClient
, which is used for thread naming and debugging.String
getUserAgent()
Return the USER_AGENT header valueint
getWebSocketMaxBufferSize()
int
getWebSocketMaxFrameSize()
Consumer<io.netty.channel.Channel>
getWsAdditionalChannelInitializer()
boolean
isAggregateWebSocketFrameFragments()
boolean
isCompressionEnforced()
Is HTTP compression enforced.boolean
isDisableHttpsEndpointIdentificationAlgorithm()
boolean
isDisableUrlEncodingForBoundRequests()
boolean
isDisableZeroCopy()
boolean
isEnableWebSocketCompression()
boolean
isFilterInsecureCipherSuites()
boolean
isFollowRedirect()
Is HTTP redirect enabledboolean
isKeepAlive()
Is theChannelPool
support enabled.boolean
isKeepEncodingHeader()
boolean
isSoKeepAlive()
boolean
isSoReuseAddress()
boolean
isStrict302Handling()
In the case of a POST/Redirect/Get scenario where the server uses a 302 for the redirect, should AHC respond to the redirect with a GET or whatever the original method was.boolean
isTcpNoDelay()
boolean
isUseInsecureTrustManager()
boolean
isUseLaxCookieEncoder()
boolean
isUseNativeTransport()
boolean
isUseOnlyEpollNativeTransport()
boolean
isUseOpenSsl()
boolean
isValidateResponseHeaders()
-
-
-
Method Detail
-
getAhcVersion
public String getAhcVersion()
- Specified by:
getAhcVersion
in interfaceAsyncHttpClientConfig
- Returns:
- the version of AHC
-
isFollowRedirect
public boolean isFollowRedirect()
Description copied from interface:AsyncHttpClientConfig
Is HTTP redirect enabled- Specified by:
isFollowRedirect
in interfaceAsyncHttpClientConfig
- Returns:
- true if enabled.
-
getMaxRedirects
public int getMaxRedirects()
Description copied from interface:AsyncHttpClientConfig
Get the maximum number of HTTP redirect- Specified by:
getMaxRedirects
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum number of HTTP redirect
-
isStrict302Handling
public boolean isStrict302Handling()
Description copied from interface:AsyncHttpClientConfig
In the case of a POST/Redirect/Get scenario where the server uses a 302 for the redirect, should AHC respond to the redirect with a GET or whatever the original method was. Unless configured otherwise, for a 302, AHC, will use a GET for this case.- Specified by:
isStrict302Handling
in interfaceAsyncHttpClientConfig
- Returns:
true
if strict 302 handling is to be used, otherwisefalse
.
-
isCompressionEnforced
public boolean isCompressionEnforced()
Description copied from interface:AsyncHttpClientConfig
Is HTTP compression enforced.- Specified by:
isCompressionEnforced
in interfaceAsyncHttpClientConfig
- Returns:
- true if compression is enforced
-
getUserAgent
public String getUserAgent()
Description copied from interface:AsyncHttpClientConfig
Return the USER_AGENT header value- Specified by:
getUserAgent
in interfaceAsyncHttpClientConfig
- Returns:
- the USER_AGENT header value
-
getRealm
public Realm getRealm()
Description copied from interface:AsyncHttpClientConfig
Return the currentRealm
- Specified by:
getRealm
in interfaceAsyncHttpClientConfig
- Returns:
- the current
Realm
-
getMaxRequestRetry
public int getMaxRequestRetry()
Description copied from interface:AsyncHttpClientConfig
Return the number of time the library will retry when anIOException
is throw by the remote server- Specified by:
getMaxRequestRetry
in interfaceAsyncHttpClientConfig
- Returns:
- the number of time the library will retry when an
IOException
is throw by the remote server
-
isDisableUrlEncodingForBoundRequests
public boolean isDisableUrlEncodingForBoundRequests()
- Specified by:
isDisableUrlEncodingForBoundRequests
in interfaceAsyncHttpClientConfig
- Returns:
- the disableUrlEncodingForBoundRequests
-
isUseLaxCookieEncoder
public boolean isUseLaxCookieEncoder()
- Specified by:
isUseLaxCookieEncoder
in interfaceAsyncHttpClientConfig
- Returns:
- true if AHC is to use a LAX cookie encoder, eg accept illegal chars in cookie value
-
isDisableZeroCopy
public boolean isDisableZeroCopy()
- Specified by:
isDisableZeroCopy
in interfaceAsyncHttpClientConfig
-
isKeepEncodingHeader
public boolean isKeepEncodingHeader()
- Specified by:
isKeepEncodingHeader
in interfaceAsyncHttpClientConfig
-
getProxyServerSelector
public ProxyServerSelector getProxyServerSelector()
Description copied from interface:AsyncHttpClientConfig
An instance ofProxyServer
used by anAsyncHttpClient
- Specified by:
getProxyServerSelector
in interfaceAsyncHttpClientConfig
- Returns:
- instance of
ProxyServer
-
isAggregateWebSocketFrameFragments
public boolean isAggregateWebSocketFrameFragments()
- Specified by:
isAggregateWebSocketFrameFragments
in interfaceAsyncHttpClientConfig
-
isEnableWebSocketCompression
public boolean isEnableWebSocketCompression()
- Specified by:
isEnableWebSocketCompression
in interfaceAsyncHttpClientConfig
-
getWebSocketMaxBufferSize
public int getWebSocketMaxBufferSize()
- Specified by:
getWebSocketMaxBufferSize
in interfaceAsyncHttpClientConfig
-
getWebSocketMaxFrameSize
public int getWebSocketMaxFrameSize()
- Specified by:
getWebSocketMaxFrameSize
in interfaceAsyncHttpClientConfig
-
getConnectTimeout
public int getConnectTimeout()
Description copied from interface:AsyncHttpClientConfig
Return the maximum time in millisecond anAsyncHttpClient
can wait when connecting to a remote host- Specified by:
getConnectTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum time in millisecond an
AsyncHttpClient
can wait when connecting to a remote host
-
getRequestTimeout
public int getRequestTimeout()
Description copied from interface:AsyncHttpClientConfig
Return the maximum time in millisecond anAsyncHttpClient
waits until the response is completed.- Specified by:
getRequestTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum time in millisecond an
AsyncHttpClient
waits until the response is completed.
-
getReadTimeout
public int getReadTimeout()
Description copied from interface:AsyncHttpClientConfig
Return the maximum time in millisecond anAsyncHttpClient
can stay idle.- Specified by:
getReadTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum time in millisecond an
AsyncHttpClient
can stay idle.
-
getShutdownQuietPeriod
public int getShutdownQuietPeriod()
- Specified by:
getShutdownQuietPeriod
in interfaceAsyncHttpClientConfig
-
getShutdownTimeout
public int getShutdownTimeout()
- Specified by:
getShutdownTimeout
in interfaceAsyncHttpClientConfig
-
isKeepAlive
public boolean isKeepAlive()
Description copied from interface:AsyncHttpClientConfig
Is theChannelPool
support enabled.- Specified by:
isKeepAlive
in interfaceAsyncHttpClientConfig
- Returns:
- true if keep-alive is enabled
-
getPooledConnectionIdleTimeout
public int getPooledConnectionIdleTimeout()
Description copied from interface:AsyncHttpClientConfig
Return the maximum time in millisecond anAsyncHttpClient
will keep connection in pool.- Specified by:
getPooledConnectionIdleTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum time in millisecond an
AsyncHttpClient
will keep connection in pool.
-
getConnectionPoolCleanerPeriod
public int getConnectionPoolCleanerPeriod()
- Specified by:
getConnectionPoolCleanerPeriod
in interfaceAsyncHttpClientConfig
- Returns:
- the period in millis to clean the pool of dead and idle connections.
-
getConnectionTtl
public int getConnectionTtl()
- Specified by:
getConnectionTtl
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum time in millisecond an
AsyncHttpClient
will keep connection in the pool, or -1 to keep connection while possible.
-
getMaxConnections
public int getMaxConnections()
Description copied from interface:AsyncHttpClientConfig
Return the maximum number of connections anAsyncHttpClient
can handle.- Specified by:
getMaxConnections
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum number of connections an
AsyncHttpClient
can handle.
-
getMaxConnectionsPerHost
public int getMaxConnectionsPerHost()
Description copied from interface:AsyncHttpClientConfig
Return the maximum number of connections per hosts anAsyncHttpClient
can handle.- Specified by:
getMaxConnectionsPerHost
in interfaceAsyncHttpClientConfig
- Returns:
- the maximum number of connections per host an
AsyncHttpClient
can handle.
-
getAcquireFreeChannelTimeout
public int getAcquireFreeChannelTimeout()
Description copied from interface:AsyncHttpClientConfig
Return the maximum duration in milliseconds anAsyncHttpClient
can wait to acquire a free channel- Specified by:
getAcquireFreeChannelTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- Return the maximum duration in milliseconds an
AsyncHttpClient
can wait to acquire a free channel
-
getChannelPool
public ChannelPool getChannelPool()
- Specified by:
getChannelPool
in interfaceAsyncHttpClientConfig
-
getConnectionSemaphoreFactory
public ConnectionSemaphoreFactory getConnectionSemaphoreFactory()
- Specified by:
getConnectionSemaphoreFactory
in interfaceAsyncHttpClientConfig
-
getKeepAliveStrategy
public KeepAliveStrategy getKeepAliveStrategy()
- Specified by:
getKeepAliveStrategy
in interfaceAsyncHttpClientConfig
-
isValidateResponseHeaders
public boolean isValidateResponseHeaders()
- Specified by:
isValidateResponseHeaders
in interfaceAsyncHttpClientConfig
-
isUseOpenSsl
public boolean isUseOpenSsl()
- Specified by:
isUseOpenSsl
in interfaceAsyncHttpClientConfig
-
isUseInsecureTrustManager
public boolean isUseInsecureTrustManager()
- Specified by:
isUseInsecureTrustManager
in interfaceAsyncHttpClientConfig
-
isDisableHttpsEndpointIdentificationAlgorithm
public boolean isDisableHttpsEndpointIdentificationAlgorithm()
- Specified by:
isDisableHttpsEndpointIdentificationAlgorithm
in interfaceAsyncHttpClientConfig
- Returns:
- true to disable all HTTPS behaviors AT ONCE, such as hostname verification and SNI
-
getHandshakeTimeout
public int getHandshakeTimeout()
- Specified by:
getHandshakeTimeout
in interfaceAsyncHttpClientConfig
-
getEnabledProtocols
public String[] getEnabledProtocols()
- Specified by:
getEnabledProtocols
in interfaceAsyncHttpClientConfig
- Returns:
- the array of enabled protocols
-
getEnabledCipherSuites
public String[] getEnabledCipherSuites()
- Specified by:
getEnabledCipherSuites
in interfaceAsyncHttpClientConfig
- Returns:
- the array of enabled cipher suites
-
isFilterInsecureCipherSuites
public boolean isFilterInsecureCipherSuites()
- Specified by:
isFilterInsecureCipherSuites
in interfaceAsyncHttpClientConfig
- Returns:
- if insecure cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites)
-
getSslSessionCacheSize
public int getSslSessionCacheSize()
- Specified by:
getSslSessionCacheSize
in interfaceAsyncHttpClientConfig
- Returns:
- the size of the SSL session cache, 0 means using the default value
-
getSslSessionTimeout
public int getSslSessionTimeout()
- Specified by:
getSslSessionTimeout
in interfaceAsyncHttpClientConfig
- Returns:
- the SSL session timeout in seconds, 0 means using the default value
-
getSslContext
public io.netty.handler.ssl.SslContext getSslContext()
Description copied from interface:AsyncHttpClientConfig
Return an instance ofSslContext
used for SSL connection.- Specified by:
getSslContext
in interfaceAsyncHttpClientConfig
- Returns:
- an instance of
SslContext
used for SSL connection.
-
getSslEngineFactory
public SslEngineFactory getSslEngineFactory()
- Specified by:
getSslEngineFactory
in interfaceAsyncHttpClientConfig
-
getRequestFilters
public List<RequestFilter> getRequestFilters()
Description copied from interface:AsyncHttpClientConfig
Return the list ofRequestFilter
- Specified by:
getRequestFilters
in interfaceAsyncHttpClientConfig
- Returns:
- Unmodifiable list of
RequestFilter
-
getResponseFilters
public List<ResponseFilter> getResponseFilters()
Description copied from interface:AsyncHttpClientConfig
Return the list ofResponseFilter
- Specified by:
getResponseFilters
in interfaceAsyncHttpClientConfig
- Returns:
- Unmodifiable list of
ResponseFilter
-
getIoExceptionFilters
public List<IOExceptionFilter> getIoExceptionFilters()
Description copied from interface:AsyncHttpClientConfig
Return the list ofIOException
- Specified by:
getIoExceptionFilters
in interfaceAsyncHttpClientConfig
- Returns:
- Unmodifiable list of
IOException
-
getCookieStore
public CookieStore getCookieStore()
Description copied from interface:AsyncHttpClientConfig
Return cookie store that is used to store and retrieve cookies- Specified by:
getCookieStore
in interfaceAsyncHttpClientConfig
- Returns:
CookieStore
object
-
expiredCookieEvictionDelay
public int expiredCookieEvictionDelay()
Description copied from interface:AsyncHttpClientConfig
Return the delay in milliseconds to evict expired cookies from CookieStore- Specified by:
expiredCookieEvictionDelay
in interfaceAsyncHttpClientConfig
- Returns:
- the delay in milliseconds to evict expired cookies from CookieStore
-
isTcpNoDelay
public boolean isTcpNoDelay()
- Specified by:
isTcpNoDelay
in interfaceAsyncHttpClientConfig
-
isSoReuseAddress
public boolean isSoReuseAddress()
- Specified by:
isSoReuseAddress
in interfaceAsyncHttpClientConfig
-
isSoKeepAlive
public boolean isSoKeepAlive()
- Specified by:
isSoKeepAlive
in interfaceAsyncHttpClientConfig
-
getSoLinger
public int getSoLinger()
- Specified by:
getSoLinger
in interfaceAsyncHttpClientConfig
-
getSoSndBuf
public int getSoSndBuf()
- Specified by:
getSoSndBuf
in interfaceAsyncHttpClientConfig
-
getSoRcvBuf
public int getSoRcvBuf()
- Specified by:
getSoRcvBuf
in interfaceAsyncHttpClientConfig
-
getThreadPoolName
public String getThreadPoolName()
Description copied from interface:AsyncHttpClientConfig
Return the name ofAsyncHttpClient
, which is used for thread naming and debugging.- Specified by:
getThreadPoolName
in interfaceAsyncHttpClientConfig
- Returns:
- the name.
-
getHttpClientCodecMaxInitialLineLength
public int getHttpClientCodecMaxInitialLineLength()
- Specified by:
getHttpClientCodecMaxInitialLineLength
in interfaceAsyncHttpClientConfig
-
getHttpClientCodecMaxHeaderSize
public int getHttpClientCodecMaxHeaderSize()
- Specified by:
getHttpClientCodecMaxHeaderSize
in interfaceAsyncHttpClientConfig
-
getHttpClientCodecMaxChunkSize
public int getHttpClientCodecMaxChunkSize()
- Specified by:
getHttpClientCodecMaxChunkSize
in interfaceAsyncHttpClientConfig
-
getHttpClientCodecInitialBufferSize
public int getHttpClientCodecInitialBufferSize()
- Specified by:
getHttpClientCodecInitialBufferSize
in interfaceAsyncHttpClientConfig
-
getChunkedFileChunkSize
public int getChunkedFileChunkSize()
- Specified by:
getChunkedFileChunkSize
in interfaceAsyncHttpClientConfig
-
getChannelOptions
public Map<io.netty.channel.ChannelOption<Object>,Object> getChannelOptions()
- Specified by:
getChannelOptions
in interfaceAsyncHttpClientConfig
-
getEventLoopGroup
public io.netty.channel.EventLoopGroup getEventLoopGroup()
- Specified by:
getEventLoopGroup
in interfaceAsyncHttpClientConfig
-
isUseNativeTransport
public boolean isUseNativeTransport()
- Specified by:
isUseNativeTransport
in interfaceAsyncHttpClientConfig
-
isUseOnlyEpollNativeTransport
public boolean isUseOnlyEpollNativeTransport()
- Specified by:
isUseOnlyEpollNativeTransport
in interfaceAsyncHttpClientConfig
-
getAllocator
public io.netty.buffer.ByteBufAllocator getAllocator()
- Specified by:
getAllocator
in interfaceAsyncHttpClientConfig
-
getNettyTimer
public io.netty.util.Timer getNettyTimer()
- Specified by:
getNettyTimer
in interfaceAsyncHttpClientConfig
-
getHashedWheelTimerTickDuration
public long getHashedWheelTimerTickDuration()
- Specified by:
getHashedWheelTimerTickDuration
in interfaceAsyncHttpClientConfig
- Returns:
- the duration between tick of
HashedWheelTimer
-
getHashedWheelTimerSize
public int getHashedWheelTimerSize()
- Specified by:
getHashedWheelTimerSize
in interfaceAsyncHttpClientConfig
- Returns:
- the size of the hashed wheel
HashedWheelTimer
-
getThreadFactory
public ThreadFactory getThreadFactory()
Description copied from interface:AsyncHttpClientConfig
Return theThreadFactory
anAsyncHttpClient
use for handling asynchronous response.- Specified by:
getThreadFactory
in interfaceAsyncHttpClientConfig
- Returns:
- the
ThreadFactory
anAsyncHttpClient
use for handling asynchronous response. If noThreadFactory
has been explicitly provided, this method will returnnull
-
getHttpAdditionalChannelInitializer
public Consumer<io.netty.channel.Channel> getHttpAdditionalChannelInitializer()
- Specified by:
getHttpAdditionalChannelInitializer
in interfaceAsyncHttpClientConfig
-
getWsAdditionalChannelInitializer
public Consumer<io.netty.channel.Channel> getWsAdditionalChannelInitializer()
- Specified by:
getWsAdditionalChannelInitializer
in interfaceAsyncHttpClientConfig
-
getResponseBodyPartFactory
public AsyncHttpClientConfig.ResponseBodyPartFactory getResponseBodyPartFactory()
- Specified by:
getResponseBodyPartFactory
in interfaceAsyncHttpClientConfig
-
getIoThreadsCount
public int getIoThreadsCount()
- Specified by:
getIoThreadsCount
in interfaceAsyncHttpClientConfig
-
-