public class

AsyncHttpClientConfig

extends Object
java.lang.Object
   ↳ com.ning.http.client.AsyncHttpClientConfig
Known Direct Subclasses

Class Overview

Configuration class to use with a AsyncHttpClient. System property can be also used to configure this object default behavior by doing:

-Dcom.ning.http.client.AsyncHttpClientConfig.nameOfTheProperty ex:

-Dcom.ning.http.client.AsyncHttpClientConfig.defaultMaxTotalConnections -Dcom.ning.http.client.AsyncHttpClientConfig.defaultMaxTotalConnections -Dcom.ning.http.client.AsyncHttpClientConfig.defaultMaxConnectionsPerHost -Dcom.ning.http.client.AsyncHttpClientConfig.defaultConnectionTimeoutInMS -Dcom.ning.http.client.AsyncHttpClientConfig.defaultIdleConnectionInPoolTimeoutInMS -Dcom.ning.http.client.AsyncHttpClientConfig.defaultRequestTimeoutInMS -Dcom.ning.http.client.AsyncHttpClientConfig.defaultRedirectsEnabled -Dcom.ning.http.client.AsyncHttpClientConfig.defaultMaxRedirects

Summary

Nested Classes
class AsyncHttpClientConfig.Builder Builder for an AsyncHttpClient  
Constants
String ASYNC_CLIENT
Fields
protected boolean allowPoolingConnection
protected boolean allowSslConnectionPool
protected ExecutorService applicationThreadPool
protected boolean compressionEnabled
protected int connectionTimeOutInMs
protected ConnectionsPool<?, ?> connectionsPool
protected HostnameVerifier hostnameVerifier
protected int idleConnectionInPoolTimeoutInMs
protected int idleConnectionTimeoutInMs
protected List<IOExceptionFilter> ioExceptionFilters
protected int ioThreadMultiplier
protected int maxConnectionPerHost
protected int maxDefaultRedirects
protected int maxRequestRetry
protected int maxTotalConnections
protected AsyncHttpProviderConfig<?, ?> providerConfig
protected ProxyServer proxyServer
protected Realm realm
protected ScheduledExecutorService reaper
protected boolean redirectEnabled
protected boolean removeQueryParamOnRedirect
protected int requestCompressionLevel
protected List<RequestFilter> requestFilters
protected int requestTimeoutInMs
protected List<ResponseFilter> responseFilters
protected SSLContext sslContext
protected SSLEngineFactory sslEngineFactory
protected boolean strict302Handling
protected boolean useRawUrl
protected String userAgent
protected int webSocketIdleTimeoutInMs
Protected Constructors
AsyncHttpClientConfig()
Public Methods
ExecutorService executorService()
Return the java.util.concurrent.ExecutorService an AsyncHttpClient use for handling asynchronous response.
boolean getAllowPoolingConnection()
Is the ConnectionsPool support enabled.
AsyncHttpProviderConfig<?, ?> getAsyncHttpProviderConfig()
int getConnectionTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host
ConnectionsPool<?, ?> getConnectionsPool()
Return an instance of ConnectionsPool
HostnameVerifier getHostnameVerifier()
Return the HostnameVerifier
List<IOExceptionFilter> getIOExceptionFilters()
Return the list of java.io.IOException
int getIdleConnectionInPoolTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient will keep connection in pool.
int getIdleConnectionTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient can stay idle.
int getIoThreadMultiplier()
boolean getKeepAlive()
This method is deprecated. - Use getAllowPoolingConnection()
int getMaxConnectionPerHost()
Return the maximum number of connections per hosts an AsyncHttpClient can handle.
int getMaxRedirects()
Get the maximum number of HTTP redirect
int getMaxRequestRetry()
Return the number of time the library will retry when an java.io.IOException is throw by the remote server
int getMaxTotalConnections()
Return the maximum number of connections an AsyncHttpClient can handle.
ProxyServer getProxyServer()
An instance of ProxyServer used by an AsyncHttpClient
Realm getRealm()
Return the current Realm}
int getRequestCompressionLevel()
Return the compression level, or -1 if no compression is used.
List<RequestFilter> getRequestFilters()
Return the list of RequestFilter
int getRequestTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient wait for a response
List<ResponseFilter> getResponseFilters()
Return the list of ResponseFilter
SSLContext getSSLContext()
Return an instance of SSLContext used for SSL connection.
SSLEngineFactory getSSLEngineFactory()
Return an instance of SSLEngineFactory used for SSL connection.
String getUserAgent()
Return the USER_AGENT header value
int getWebSocketIdleTimeoutInMs()
Return the maximum time, in milliseconds, a WebSocket may be idle before being timed out.
boolean isClosed()
Return true if one of the java.util.concurrent.ExecutorService has been shutdown.
boolean isCompressionEnabled()
Is HTTP compression enabled.
boolean isRedirectEnabled()
Is HTTP redirect enabled
boolean isRemoveQueryParamOnRedirect()
Return true if the query parameters will be stripped from the request when a redirect is requested.
boolean isSslConnectionPoolEnabled()
Return true is SSL connection polling is enabled.
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 isUseRawUrl()
ScheduledExecutorService reaper()
A ScheduledExecutorService used to expire idle connections.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final String ASYNC_CLIENT

Fields

protected boolean allowPoolingConnection

protected boolean allowSslConnectionPool

protected ExecutorService applicationThreadPool

protected boolean compressionEnabled

protected int connectionTimeOutInMs

protected ConnectionsPool<?, ?> connectionsPool

protected HostnameVerifier hostnameVerifier

protected int idleConnectionInPoolTimeoutInMs

protected int idleConnectionTimeoutInMs

protected List<IOExceptionFilter> ioExceptionFilters

protected int ioThreadMultiplier

protected int maxConnectionPerHost

protected int maxDefaultRedirects

protected int maxRequestRetry

protected int maxTotalConnections

protected AsyncHttpProviderConfig<?, ?> providerConfig

protected ProxyServer proxyServer

protected Realm realm

protected ScheduledExecutorService reaper

protected boolean redirectEnabled

protected boolean removeQueryParamOnRedirect

protected int requestCompressionLevel

protected List<RequestFilter> requestFilters

protected int requestTimeoutInMs

protected List<ResponseFilter> responseFilters

protected SSLContext sslContext

protected SSLEngineFactory sslEngineFactory

protected boolean strict302Handling

protected boolean useRawUrl

protected String userAgent

protected int webSocketIdleTimeoutInMs

Protected Constructors

protected AsyncHttpClientConfig ()

Public Methods

public ExecutorService executorService ()

Return the java.util.concurrent.ExecutorService an AsyncHttpClient use for handling asynchronous response.

Returns
  • the java.util.concurrent.ExecutorService an AsyncHttpClient use for handling asynchronous response.

public boolean getAllowPoolingConnection ()

Is the ConnectionsPool support enabled.

Returns
  • true if keep-alive is enabled

public AsyncHttpProviderConfig<?, ?> getAsyncHttpProviderConfig ()

public int getConnectionTimeoutInMs ()

Return the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host

Returns
  • the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host

public ConnectionsPool<?, ?> getConnectionsPool ()

Return an instance of ConnectionsPool

Returns

public HostnameVerifier getHostnameVerifier ()

Return the HostnameVerifier

Returns
  • the HostnameVerifier

public List<IOExceptionFilter> getIOExceptionFilters ()

Return the list of java.io.IOException

Returns
  • Unmodifiable list of java.io.IOException

public int getIdleConnectionInPoolTimeoutInMs ()

Return the maximum time in millisecond an AsyncHttpClient will keep connection in pool.

Returns
  • the maximum time in millisecond an AsyncHttpClient will keep connection in pool.

public int getIdleConnectionTimeoutInMs ()

Return the maximum time in millisecond an AsyncHttpClient can stay idle.

Returns

public int getIoThreadMultiplier ()

Returns
  • number to multiply by availableProcessors() that will determine # of NioWorkers to use

public boolean getKeepAlive ()

This method is deprecated.
- Use getAllowPoolingConnection()

Is the ConnectionsPool support enabled.

Returns
  • true if keep-alive is enabled

public int getMaxConnectionPerHost ()

Return the maximum number of connections per hosts an AsyncHttpClient can handle.

Returns

public int getMaxRedirects ()

Get the maximum number of HTTP redirect

Returns
  • the maximum number of HTTP redirect

public int getMaxRequestRetry ()

Return the number of time the library will retry when an java.io.IOException is throw by the remote server

Returns
  • the number of time the library will retry when an java.io.IOException is throw by the remote server

public int getMaxTotalConnections ()

Return the maximum number of connections an AsyncHttpClient can handle.

Returns

public ProxyServer getProxyServer ()

An instance of ProxyServer used by an AsyncHttpClient

Returns

public Realm getRealm ()

Return the current Realm}

Returns

public int getRequestCompressionLevel ()

Return the compression level, or -1 if no compression is used.

Returns
  • the compression level, or -1 if no compression is use

public List<RequestFilter> getRequestFilters ()

Return the list of RequestFilter

Returns

public int getRequestTimeoutInMs ()

Return the maximum time in millisecond an AsyncHttpClient wait for a response

Returns

public List<ResponseFilter> getResponseFilters ()

Return the list of ResponseFilter

Returns

public SSLContext getSSLContext ()

Return an instance of SSLContext used for SSL connection.

Returns
  • an instance of SSLContext used for SSL connection.

public SSLEngineFactory getSSLEngineFactory ()

Return an instance of SSLEngineFactory used for SSL connection.

Returns

public String getUserAgent ()

Return the USER_AGENT header value

Returns
  • the USER_AGENT header value

public int getWebSocketIdleTimeoutInMs ()

Return the maximum time, in milliseconds, a WebSocket may be idle before being timed out.

Returns
  • the maximum time, in milliseconds, a WebSocket may be idle before being timed out.

public boolean isClosed ()

Return true if one of the java.util.concurrent.ExecutorService has been shutdown.

Returns
  • true if one of the java.util.concurrent.ExecutorService has been shutdown.

public boolean isCompressionEnabled ()

Is HTTP compression enabled.

Returns
  • true if compression is enabled

public boolean isRedirectEnabled ()

Is HTTP redirect enabled

Returns
  • true if enabled.

public boolean isRemoveQueryParamOnRedirect ()

Return true if the query parameters will be stripped from the request when a redirect is requested.

Returns
  • true if the query parameters will be stripped from the request when a redirect is requested.

public boolean isSslConnectionPoolEnabled ()

Return true is SSL connection polling is enabled. Default is true.

Returns
  • true is enabled.

public 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. Unless configured otherwise, for a 302, AHC, will use a GET for this case.

Returns
  • true if string 302 handling is to be used, otherwise false.

public boolean isUseRawUrl ()

Returns
  • the useRawUrl

public ScheduledExecutorService reaper ()

A ScheduledExecutorService used to expire idle connections.

Returns
  • ScheduledExecutorService