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 classDefaultAsyncHttpClientConfig.BuilderBuilder for anAsyncHttpClient-
Nested classes/interfaces inherited from interface org.asynchttpclient.AsyncHttpClientConfig
AsyncHttpClientConfig.ResponseBodyPartFactory
-
-
Method Summary
-
-
-
Method Detail
-
getAhcVersion
public String getAhcVersion()
- Specified by:
getAhcVersionin interfaceAsyncHttpClientConfig- Returns:
- the version of AHC
-
isFollowRedirect
public boolean isFollowRedirect()
Description copied from interface:AsyncHttpClientConfigIs HTTP redirect enabled- Specified by:
isFollowRedirectin interfaceAsyncHttpClientConfig- Returns:
- true if enabled.
-
getMaxRedirects
public int getMaxRedirects()
Description copied from interface:AsyncHttpClientConfigGet the maximum number of HTTP redirect- Specified by:
getMaxRedirectsin interfaceAsyncHttpClientConfig- Returns:
- the maximum number of HTTP redirect
-
isStrict302Handling
public boolean isStrict302Handling()
Description copied from interface:AsyncHttpClientConfigIn 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:
isStrict302Handlingin interfaceAsyncHttpClientConfig- Returns:
trueif strict 302 handling is to be used, otherwisefalse.
-
isCompressionEnforced
public boolean isCompressionEnforced()
Description copied from interface:AsyncHttpClientConfigIs HTTP compression enforced.- Specified by:
isCompressionEnforcedin interfaceAsyncHttpClientConfig- Returns:
- true if compression is enforced
-
getUserAgent
public String getUserAgent()
Description copied from interface:AsyncHttpClientConfigReturn the USER_AGENT header value- Specified by:
getUserAgentin interfaceAsyncHttpClientConfig- Returns:
- the USER_AGENT header value
-
getRealm
public Realm getRealm()
Description copied from interface:AsyncHttpClientConfigReturn the currentRealm- Specified by:
getRealmin interfaceAsyncHttpClientConfig- Returns:
- the current
Realm
-
getMaxRequestRetry
public int getMaxRequestRetry()
Description copied from interface:AsyncHttpClientConfigReturn the number of time the library will retry when anIOExceptionis throw by the remote server- Specified by:
getMaxRequestRetryin interfaceAsyncHttpClientConfig- Returns:
- the number of time the library will retry when an
IOExceptionis throw by the remote server
-
isDisableUrlEncodingForBoundRequests
public boolean isDisableUrlEncodingForBoundRequests()
- Specified by:
isDisableUrlEncodingForBoundRequestsin interfaceAsyncHttpClientConfig- Returns:
- the disableUrlEncodingForBoundRequests
-
isUseLaxCookieEncoder
public boolean isUseLaxCookieEncoder()
- Specified by:
isUseLaxCookieEncoderin 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:
isDisableZeroCopyin interfaceAsyncHttpClientConfig
-
isKeepEncodingHeader
public boolean isKeepEncodingHeader()
- Specified by:
isKeepEncodingHeaderin interfaceAsyncHttpClientConfig
-
getProxyServerSelector
public ProxyServerSelector getProxyServerSelector()
Description copied from interface:AsyncHttpClientConfigAn instance ofProxyServerused by anAsyncHttpClient- Specified by:
getProxyServerSelectorin interfaceAsyncHttpClientConfig- Returns:
- instance of
ProxyServer
-
isAggregateWebSocketFrameFragments
public boolean isAggregateWebSocketFrameFragments()
- Specified by:
isAggregateWebSocketFrameFragmentsin interfaceAsyncHttpClientConfig
-
isEnableWebSocketCompression
public boolean isEnableWebSocketCompression()
- Specified by:
isEnableWebSocketCompressionin interfaceAsyncHttpClientConfig
-
getWebSocketMaxBufferSize
public int getWebSocketMaxBufferSize()
- Specified by:
getWebSocketMaxBufferSizein interfaceAsyncHttpClientConfig
-
getWebSocketMaxFrameSize
public int getWebSocketMaxFrameSize()
- Specified by:
getWebSocketMaxFrameSizein interfaceAsyncHttpClientConfig
-
getConnectTimeout
public Duration getConnectTimeout()
Description copied from interface:AsyncHttpClientConfigReturn the maximum time anAsyncHttpClientcan wait when connecting to a remote host- Specified by:
getConnectTimeoutin interfaceAsyncHttpClientConfig- Returns:
- the maximum time an
AsyncHttpClientcan wait when connecting to a remote host
-
getRequestTimeout
public Duration getRequestTimeout()
Description copied from interface:AsyncHttpClientConfigReturn the maximum time anAsyncHttpClientwaits until the response is completed.- Specified by:
getRequestTimeoutin interfaceAsyncHttpClientConfig- Returns:
- the maximum time an
AsyncHttpClientwaits until the response is completed.
-
getReadTimeout
public Duration getReadTimeout()
Description copied from interface:AsyncHttpClientConfigReturn the maximum time anAsyncHttpClientcan stay idle.- Specified by:
getReadTimeoutin interfaceAsyncHttpClientConfig- Returns:
- the maximum time an
AsyncHttpClientcan stay idle.
-
getShutdownQuietPeriod
public Duration getShutdownQuietPeriod()
- Specified by:
getShutdownQuietPeriodin interfaceAsyncHttpClientConfig
-
getShutdownTimeout
public Duration getShutdownTimeout()
- Specified by:
getShutdownTimeoutin interfaceAsyncHttpClientConfig
-
isKeepAlive
public boolean isKeepAlive()
Description copied from interface:AsyncHttpClientConfigIs theChannelPoolsupport enabled.- Specified by:
isKeepAlivein interfaceAsyncHttpClientConfig- Returns:
- true if keep-alive is enabled
-
getPooledConnectionIdleTimeout
public Duration getPooledConnectionIdleTimeout()
Description copied from interface:AsyncHttpClientConfigReturn the maximum time anAsyncHttpClientwill keep connection in pool.- Specified by:
getPooledConnectionIdleTimeoutin interfaceAsyncHttpClientConfig- Returns:
- the maximum time an
AsyncHttpClientwill keep connection in pool.
-
getConnectionPoolCleanerPeriod
public Duration getConnectionPoolCleanerPeriod()
- Specified by:
getConnectionPoolCleanerPeriodin interfaceAsyncHttpClientConfig- Returns:
- the period to clean the pool of dead and idle connections.
-
getConnectionTtl
public Duration getConnectionTtl()
- Specified by:
getConnectionTtlin interfaceAsyncHttpClientConfig- Returns:
- the maximum time an
AsyncHttpClientwill keep connection in the pool, or negative value to keep connection while possible.
-
getMaxConnections
public int getMaxConnections()
Description copied from interface:AsyncHttpClientConfigReturn the maximum number of connections anAsyncHttpClientcan handle.- Specified by:
getMaxConnectionsin interfaceAsyncHttpClientConfig- Returns:
- the maximum number of connections an
AsyncHttpClientcan handle.
-
getMaxConnectionsPerHost
public int getMaxConnectionsPerHost()
Description copied from interface:AsyncHttpClientConfigReturn the maximum number of connections per hosts anAsyncHttpClientcan handle.- Specified by:
getMaxConnectionsPerHostin interfaceAsyncHttpClientConfig- Returns:
- the maximum number of connections per host an
AsyncHttpClientcan handle.
-
getAcquireFreeChannelTimeout
public int getAcquireFreeChannelTimeout()
Description copied from interface:AsyncHttpClientConfigReturn the maximum duration in milliseconds anAsyncHttpClientcan wait to acquire a free channel- Specified by:
getAcquireFreeChannelTimeoutin interfaceAsyncHttpClientConfig- Returns:
- Return the maximum duration in milliseconds an
AsyncHttpClientcan wait to acquire a free channel
-
getChannelPool
public ChannelPool getChannelPool()
- Specified by:
getChannelPoolin interfaceAsyncHttpClientConfig
-
getConnectionSemaphoreFactory
public ConnectionSemaphoreFactory getConnectionSemaphoreFactory()
- Specified by:
getConnectionSemaphoreFactoryin interfaceAsyncHttpClientConfig
-
getKeepAliveStrategy
public KeepAliveStrategy getKeepAliveStrategy()
- Specified by:
getKeepAliveStrategyin interfaceAsyncHttpClientConfig
-
isValidateResponseHeaders
public boolean isValidateResponseHeaders()
- Specified by:
isValidateResponseHeadersin interfaceAsyncHttpClientConfig
-
isUseOpenSsl
public boolean isUseOpenSsl()
- Specified by:
isUseOpenSslin interfaceAsyncHttpClientConfig
-
isUseInsecureTrustManager
public boolean isUseInsecureTrustManager()
- Specified by:
isUseInsecureTrustManagerin interfaceAsyncHttpClientConfig
-
isDisableHttpsEndpointIdentificationAlgorithm
public boolean isDisableHttpsEndpointIdentificationAlgorithm()
- Specified by:
isDisableHttpsEndpointIdentificationAlgorithmin interfaceAsyncHttpClientConfig- Returns:
- true to disable all HTTPS behaviors AT ONCE, such as hostname verification and SNI
-
getHandshakeTimeout
public int getHandshakeTimeout()
- Specified by:
getHandshakeTimeoutin interfaceAsyncHttpClientConfig
-
getEnabledProtocols
public String[] getEnabledProtocols()
- Specified by:
getEnabledProtocolsin interfaceAsyncHttpClientConfig- Returns:
- the array of enabled protocols
-
getEnabledCipherSuites
public String[] getEnabledCipherSuites()
- Specified by:
getEnabledCipherSuitesin interfaceAsyncHttpClientConfig- Returns:
- the array of enabled cipher suites
-
isFilterInsecureCipherSuites
public boolean isFilterInsecureCipherSuites()
- Specified by:
isFilterInsecureCipherSuitesin 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:
getSslSessionCacheSizein interfaceAsyncHttpClientConfig- Returns:
- the size of the SSL session cache, 0 means using the default value
-
getSslSessionTimeout
public int getSslSessionTimeout()
- Specified by:
getSslSessionTimeoutin 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:AsyncHttpClientConfigReturn an instance ofSslContextused for SSL connection.- Specified by:
getSslContextin interfaceAsyncHttpClientConfig- Returns:
- an instance of
SslContextused for SSL connection.
-
getSslEngineFactory
public SslEngineFactory getSslEngineFactory()
- Specified by:
getSslEngineFactoryin interfaceAsyncHttpClientConfig
-
getRequestFilters
public List<RequestFilter> getRequestFilters()
Description copied from interface:AsyncHttpClientConfigReturn the list ofRequestFilter- Specified by:
getRequestFiltersin interfaceAsyncHttpClientConfig- Returns:
- Unmodifiable list of
RequestFilter
-
getResponseFilters
public List<ResponseFilter> getResponseFilters()
Description copied from interface:AsyncHttpClientConfigReturn the list ofResponseFilter- Specified by:
getResponseFiltersin interfaceAsyncHttpClientConfig- Returns:
- Unmodifiable list of
ResponseFilter
-
getIoExceptionFilters
public List<IOExceptionFilter> getIoExceptionFilters()
Description copied from interface:AsyncHttpClientConfigReturn the list ofIOException- Specified by:
getIoExceptionFiltersin interfaceAsyncHttpClientConfig- Returns:
- Unmodifiable list of
IOException
-
getCookieStore
public CookieStore getCookieStore()
Description copied from interface:AsyncHttpClientConfigReturn cookie store that is used to store and retrieve cookies- Specified by:
getCookieStorein interfaceAsyncHttpClientConfig- Returns:
CookieStoreobject
-
expiredCookieEvictionDelay
public int expiredCookieEvictionDelay()
Description copied from interface:AsyncHttpClientConfigReturn the delay in milliseconds to evict expired cookies from CookieStore- Specified by:
expiredCookieEvictionDelayin interfaceAsyncHttpClientConfig- Returns:
- the delay in milliseconds to evict expired cookies from CookieStore
-
isTcpNoDelay
public boolean isTcpNoDelay()
- Specified by:
isTcpNoDelayin interfaceAsyncHttpClientConfig
-
isSoReuseAddress
public boolean isSoReuseAddress()
- Specified by:
isSoReuseAddressin interfaceAsyncHttpClientConfig
-
isSoKeepAlive
public boolean isSoKeepAlive()
- Specified by:
isSoKeepAlivein interfaceAsyncHttpClientConfig
-
getSoLinger
public int getSoLinger()
- Specified by:
getSoLingerin interfaceAsyncHttpClientConfig
-
getSoSndBuf
public int getSoSndBuf()
- Specified by:
getSoSndBufin interfaceAsyncHttpClientConfig
-
getSoRcvBuf
public int getSoRcvBuf()
- Specified by:
getSoRcvBufin interfaceAsyncHttpClientConfig
-
getThreadPoolName
public String getThreadPoolName()
Description copied from interface:AsyncHttpClientConfigReturn the name ofAsyncHttpClient, which is used for thread naming and debugging.- Specified by:
getThreadPoolNamein interfaceAsyncHttpClientConfig- Returns:
- the name.
-
getHttpClientCodecMaxInitialLineLength
public int getHttpClientCodecMaxInitialLineLength()
- Specified by:
getHttpClientCodecMaxInitialLineLengthin interfaceAsyncHttpClientConfig
-
getHttpClientCodecMaxHeaderSize
public int getHttpClientCodecMaxHeaderSize()
- Specified by:
getHttpClientCodecMaxHeaderSizein interfaceAsyncHttpClientConfig
-
getHttpClientCodecMaxChunkSize
public int getHttpClientCodecMaxChunkSize()
- Specified by:
getHttpClientCodecMaxChunkSizein interfaceAsyncHttpClientConfig
-
getHttpClientCodecInitialBufferSize
public int getHttpClientCodecInitialBufferSize()
- Specified by:
getHttpClientCodecInitialBufferSizein interfaceAsyncHttpClientConfig
-
getChunkedFileChunkSize
public int getChunkedFileChunkSize()
- Specified by:
getChunkedFileChunkSizein interfaceAsyncHttpClientConfig
-
getChannelOptions
public Map<io.netty.channel.ChannelOption<Object>,Object> getChannelOptions()
- Specified by:
getChannelOptionsin interfaceAsyncHttpClientConfig
-
getEventLoopGroup
public io.netty.channel.EventLoopGroup getEventLoopGroup()
- Specified by:
getEventLoopGroupin interfaceAsyncHttpClientConfig
-
isUseNativeTransport
public boolean isUseNativeTransport()
- Specified by:
isUseNativeTransportin interfaceAsyncHttpClientConfig
-
isUseOnlyEpollNativeTransport
public boolean isUseOnlyEpollNativeTransport()
- Specified by:
isUseOnlyEpollNativeTransportin interfaceAsyncHttpClientConfig
-
getAllocator
public io.netty.buffer.ByteBufAllocator getAllocator()
- Specified by:
getAllocatorin interfaceAsyncHttpClientConfig
-
getNettyTimer
public io.netty.util.Timer getNettyTimer()
- Specified by:
getNettyTimerin interfaceAsyncHttpClientConfig
-
getHashedWheelTimerTickDuration
public long getHashedWheelTimerTickDuration()
- Specified by:
getHashedWheelTimerTickDurationin interfaceAsyncHttpClientConfig- Returns:
- the duration between tick of
HashedWheelTimer
-
getHashedWheelTimerSize
public int getHashedWheelTimerSize()
- Specified by:
getHashedWheelTimerSizein interfaceAsyncHttpClientConfig- Returns:
- the size of the hashed wheel
HashedWheelTimer
-
getThreadFactory
public ThreadFactory getThreadFactory()
Description copied from interface:AsyncHttpClientConfigReturn theThreadFactoryanAsyncHttpClientuse for handling asynchronous response.- Specified by:
getThreadFactoryin interfaceAsyncHttpClientConfig- Returns:
- the
ThreadFactoryanAsyncHttpClientuse for handling asynchronous response. If noThreadFactoryhas been explicitly provided, this method will returnnull
-
getHttpAdditionalChannelInitializer
public Consumer<io.netty.channel.Channel> getHttpAdditionalChannelInitializer()
- Specified by:
getHttpAdditionalChannelInitializerin interfaceAsyncHttpClientConfig
-
getWsAdditionalChannelInitializer
public Consumer<io.netty.channel.Channel> getWsAdditionalChannelInitializer()
- Specified by:
getWsAdditionalChannelInitializerin interfaceAsyncHttpClientConfig
-
getResponseBodyPartFactory
public AsyncHttpClientConfig.ResponseBodyPartFactory getResponseBodyPartFactory()
- Specified by:
getResponseBodyPartFactoryin interfaceAsyncHttpClientConfig
-
getIoThreadsCount
public int getIoThreadsCount()
- Specified by:
getIoThreadsCountin interfaceAsyncHttpClientConfig
-
-