public static class AsyncHttpClientConfig.Builder extends Object
AsyncHttpClient| Constructor and Description |
|---|
AsyncHttpClientConfig.Builder() |
AsyncHttpClientConfig.Builder(AsyncHttpClientConfig prototype)
Create a config builder with values taken from the given prototype configuration.
|
public AsyncHttpClientConfig.Builder()
public AsyncHttpClientConfig.Builder(AsyncHttpClientConfig prototype)
prototype - the configuration to use as a prototype.public AsyncHttpClientConfig.Builder setMaximumConnectionsTotal(int defaultMaxTotalConnections)
AsyncHttpClient can handle.defaultMaxTotalConnections - the maximum number of connections an AsyncHttpClient can handle.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost)
AsyncHttpClient can handle.defaultMaxConnectionPerHost - the maximum number of connections per host an AsyncHttpClient can handle.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setConnectionTimeoutInMs(int defaultConnectionTimeOutInMs)
AsyncHttpClient can wait when connecting to a remote hostdefaultConnectionTimeOutInMs - the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote hostAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setIdleConnectionTimeoutInMs(int defaultIdleConnectionTimeoutInMs)
setIdleConnectionInPoolTimeoutInMs(int)AsyncHttpClient can stay idle.defaultIdleConnectionTimeoutInMs - the maximum time in millisecond an AsyncHttpClient can stay idle.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setIdleConnectionInPoolTimeoutInMs(int defaultIdleConnectionInPoolTimeoutInMs)
AsyncHttpClient will keep connection
idle in pool.defaultIdleConnectionInPoolTimeoutInMs - the maximum time in millisecond an AsyncHttpClient will keep connection
idle in pool.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setRequestTimeoutInMs(int defaultRequestTimeoutInMs)
AsyncHttpClient wait for a responsedefaultRequestTimeoutInMs - the maximum time in millisecond an AsyncHttpClient wait for a responseAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setFollowRedirects(boolean redirectEnabled)
redirectEnabled - true if enabled.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setMaximumNumberOfRedirects(int maxDefaultRedirects)
maxDefaultRedirects - the maximum number of HTTP redirectAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setCompressionEnabled(boolean compressionEnabled)
compressionEnabled - true if compression is enabledAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setUserAgent(String userAgent)
userAgent - the USER_AGENT header valueAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setAllowPoolingConnection(boolean allowPoolingConnection)
ConnectionsPool. Default is true.allowPoolingConnection - true if connection can be pooled by a ConnectionsPoolAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setKeepAlive(boolean allowPoolingConnection)
setAllowPoolingConnection(boolean)ConnectionsPool. Default is true.allowPoolingConnection - true if connection can be pooled by a ConnectionsPoolAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setScheduledExecutorService(ScheduledExecutorService reaper)
ScheduledExecutorService used to expire idle connections.reaper - theScheduledExecutorService used to expire idle connections.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setExecutorService(ExecutorService applicationThreadPool)
ExecutorService an AsyncHttpClient use for handling
asynchronous response.applicationThreadPool - the ExecutorService an AsyncHttpClient use for handling
asynchronous response.AsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setProxyServer(ProxyServer proxyServer)
ProxyServer used by an AsyncHttpClientproxyServer - instance of ProxyServerAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setSSLEngineFactory(SSLEngineFactory sslEngineFactory)
SSLEngineFactory for secure connection.sslEngineFactory - the SSLEngineFactory for secure connectionAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setSSLContext(SSLContext sslContext)
SSLContext for secure connection.sslContext - the SSLContext for secure connectionAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setAsyncHttpClientProviderConfig(AsyncHttpProviderConfig<?,?> providerConfig)
AsyncHttpProviderConfigproviderConfig - the AsyncHttpProviderConfigAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setConnectionsPool(ConnectionsPool<?,?> connectionsPool)
ConnectionsPoolconnectionsPool - the ConnectionsPoolAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder setRealm(Realm realm)
Realm that will be used for all requests.realm - the RealmAsyncHttpClientConfig.Builderpublic AsyncHttpClientConfig.Builder addRequestFilter(RequestFilter requestFilter)
RequestFilter that will be invoked before AsyncHttpClient.executeRequest(Request)requestFilter - RequestFilterpublic AsyncHttpClientConfig.Builder removeRequestFilter(RequestFilter requestFilter)
RequestFilter that will be invoked before AsyncHttpClient.executeRequest(Request)requestFilter - RequestFilterpublic AsyncHttpClientConfig.Builder addResponseFilter(ResponseFilter responseFilter)
ResponseFilter that will be invoked as soon as the response is
received, and before AsyncHandler.onStatusReceived(HttpResponseStatus).responseFilter - an ResponseFilterpublic AsyncHttpClientConfig.Builder removeResponseFilter(ResponseFilter responseFilter)
ResponseFilter that will be invoked as soon as the response is
received, and before AsyncHandler.onStatusReceived(HttpResponseStatus).responseFilter - an ResponseFilterpublic AsyncHttpClientConfig.Builder addIOExceptionFilter(IOExceptionFilter ioExceptionFilter)
IOExceptionFilter that will be invoked when an IOException
occurs during the download/upload operations.ioExceptionFilter - an ResponseFilterpublic AsyncHttpClientConfig.Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter)
IOExceptionFilter tthat will be invoked when an IOException
occurs during the download/upload operations.ioExceptionFilter - an ResponseFilterpublic int getRequestCompressionLevel()
public AsyncHttpClientConfig.Builder setRequestCompressionLevel(int requestCompressionLevel)
requestCompressionLevel - compression level, or -1 if no compression is usepublic AsyncHttpClientConfig.Builder setMaxRequestRetry(int maxRequestRetry)
IOException occurs because of a Network exception.maxRequestRetry - the number of time a request will be retriedpublic AsyncHttpClientConfig.Builder setAllowSslConnectionPool(boolean allowSslConnectionPool)
allowSslConnectionPool - true if enabledpublic AsyncHttpClientConfig build()
AsyncHttpClientConfigAsyncHttpClientConfigCopyright © 2012. All Rights Reserved.