com.ning.http.client
Class AsyncHttpClientConfig

java.lang.Object
  extended by com.ning.http.client.AsyncHttpClientConfig
Direct Known Subclasses:
AsyncHttpClientConfigBean

public class AsyncHttpClientConfig
extends Object

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


Nested Class Summary
static class AsyncHttpClientConfig.Builder
          Builder for an AsyncHttpClient
 
Field Summary
protected  boolean acceptAnyCertificate
           
protected  boolean allowPoolingConnection
           
protected  boolean allowSslConnectionPool
           
protected  ExecutorService applicationThreadPool
           
protected  boolean compressionEnabled
           
protected  ConnectionsPool<?,?> connectionsPool
           
protected  int connectionTimeOutInMs
           
protected  boolean disableUrlEncodingForBoundedRequests
           
protected  boolean followRedirect
           
protected  HostnameVerifier hostnameVerifier
           
protected  int idleConnectionInPoolTimeoutInMs
           
protected  int idleConnectionTimeoutInMs
           
protected  List<IOExceptionFilter> ioExceptionFilters
           
protected  int ioThreadMultiplier
           
protected  int maxConnectionLifeTimeInMs
           
protected  int maxConnectionPerHost
           
protected  int maxRedirects
           
protected  int maxRequestRetry
           
protected  int maxTotalConnections
           
protected  AsyncHttpProviderConfig<?,?> providerConfig
           
protected  ProxyServerSelector proxyServerSelector
           
protected  Realm realm
           
protected  boolean removeQueryParamOnRedirect
           
protected  int requestCompressionLevel
           
protected  List<RequestFilter> requestFilters
           
protected  int requestTimeoutInMs
           
protected  List<ResponseFilter> responseFilters
           
protected  SSLContext sslContext
           
protected  boolean strict302Handling
           
protected  TimeConverter timeConverter
           
protected  String userAgent
           
protected  boolean useRelativeURIsWithSSLProxies
           
protected  int webSocketIdleTimeoutInMs
           
 
Constructor Summary
protected AsyncHttpClientConfig()
           
 
Method Summary
 ExecutorService executorService()
          Return the ExecutorService an AsyncHttpClient use for handling asynchronous response.
 AsyncHttpProviderConfig<?,?> getAsyncHttpProviderConfig()
          Return the AsyncHttpProviderConfig
 ConnectionsPool<?,?> getConnectionsPool()
          Return an instance of ConnectionsPool
 int getConnectionTimeoutInMs()
          Return the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host
 HostnameVerifier getHostnameVerifier()
          Return the HostnameVerifier
 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.
 List<IOExceptionFilter> getIOExceptionFilters()
          Return the list of IOException
 int getIoThreadMultiplier()
           
 int getMaxConnectionLifeTimeInMs()
          Return the maximum time in millisecond an AsyncHttpClient will keep connection in the pool, or -1 to keep connection while possible.
 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 IOException is throw by the remote server
 int getMaxTotalConnections()
          Return the maximum number of connections an AsyncHttpClient can handle.
 ProxyServerSelector getProxyServerSelector()
          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.
 TimeConverter getTimeConverter()
          since 1.8.2
 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 isAcceptAnyCertificate()
          since 1.9.0
 boolean isAllowPoolingConnection()
          Is the ConnectionsPool support enabled.
 boolean isCompressionEnabled()
          Is HTTP compression enabled.
 boolean isDisableUrlEncodingForBoundedRequests()
           
 boolean isFollowRedirect()
          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 isUseRelativeURIsWithSSLProxies()
           
 boolean isValid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxTotalConnections

protected int maxTotalConnections

maxConnectionPerHost

protected int maxConnectionPerHost

connectionTimeOutInMs

protected int connectionTimeOutInMs

webSocketIdleTimeoutInMs

protected int webSocketIdleTimeoutInMs

idleConnectionInPoolTimeoutInMs

protected int idleConnectionInPoolTimeoutInMs

idleConnectionTimeoutInMs

protected int idleConnectionTimeoutInMs

requestTimeoutInMs

protected int requestTimeoutInMs

followRedirect

protected boolean followRedirect

maxRedirects

protected int maxRedirects

compressionEnabled

protected boolean compressionEnabled

userAgent

protected String userAgent

allowPoolingConnection

protected boolean allowPoolingConnection

applicationThreadPool

protected ExecutorService applicationThreadPool

proxyServerSelector

protected ProxyServerSelector proxyServerSelector

sslContext

protected SSLContext sslContext

providerConfig

protected AsyncHttpProviderConfig<?,?> providerConfig

connectionsPool

protected ConnectionsPool<?,?> connectionsPool

realm

protected Realm realm

requestFilters

protected List<RequestFilter> requestFilters

responseFilters

protected List<ResponseFilter> responseFilters

ioExceptionFilters

protected List<IOExceptionFilter> ioExceptionFilters

requestCompressionLevel

protected int requestCompressionLevel

maxRequestRetry

protected int maxRequestRetry

allowSslConnectionPool

protected boolean allowSslConnectionPool

disableUrlEncodingForBoundedRequests

protected boolean disableUrlEncodingForBoundedRequests

removeQueryParamOnRedirect

protected boolean removeQueryParamOnRedirect

hostnameVerifier

protected HostnameVerifier hostnameVerifier

ioThreadMultiplier

protected int ioThreadMultiplier

strict302Handling

protected boolean strict302Handling

useRelativeURIsWithSSLProxies

protected boolean useRelativeURIsWithSSLProxies

maxConnectionLifeTimeInMs

protected int maxConnectionLifeTimeInMs

timeConverter

protected TimeConverter timeConverter

acceptAnyCertificate

protected boolean acceptAnyCertificate
Constructor Detail

AsyncHttpClientConfig

protected AsyncHttpClientConfig()
Method Detail

getMaxTotalConnections

public int getMaxTotalConnections()
Return the maximum number of connections an AsyncHttpClient can handle.

Returns:
the maximum number of connections an AsyncHttpClient can handle.

getMaxConnectionPerHost

public int getMaxConnectionPerHost()
Return the maximum number of connections per hosts an AsyncHttpClient can handle.

Returns:
the maximum number of connections per host an AsyncHttpClient can handle.

getConnectionTimeoutInMs

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

getWebSocketIdleTimeoutInMs

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.

getIdleConnectionTimeoutInMs

public int getIdleConnectionTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient can stay idle.

Returns:
the maximum time in millisecond an AsyncHttpClient can stay idle.

getIdleConnectionInPoolTimeoutInMs

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.

getRequestTimeoutInMs

public int getRequestTimeoutInMs()
Return the maximum time in millisecond an AsyncHttpClient wait for a response

Returns:
the maximum time in millisecond an AsyncHttpClient wait for a response

isFollowRedirect

public boolean isFollowRedirect()
Is HTTP redirect enabled

Returns:
true if enabled.

getMaxRedirects

public int getMaxRedirects()
Get the maximum number of HTTP redirect

Returns:
the maximum number of HTTP redirect

isAllowPoolingConnection

public boolean isAllowPoolingConnection()
Is the ConnectionsPool support enabled.

Returns:
true if keep-alive is enabled

getUserAgent

public String getUserAgent()
Return the USER_AGENT header value

Returns:
the USER_AGENT header value

isCompressionEnabled

public boolean isCompressionEnabled()
Is HTTP compression enabled.

Returns:
true if compression is enabled

executorService

public ExecutorService executorService()
Return the ExecutorService an AsyncHttpClient use for handling asynchronous response.

Returns:
the ExecutorService an AsyncHttpClient use for handling asynchronous response.

getProxyServerSelector

public ProxyServerSelector getProxyServerSelector()
An instance of ProxyServer used by an AsyncHttpClient

Returns:
instance of ProxyServer

getSSLContext

public SSLContext getSSLContext()
Return an instance of SSLContext used for SSL connection.

Returns:
an instance of SSLContext used for SSL connection.

getConnectionsPool

public ConnectionsPool<?,?> getConnectionsPool()
Return an instance of ConnectionsPool

Returns:
an instance of ConnectionsPool

getAsyncHttpProviderConfig

public AsyncHttpProviderConfig<?,?> getAsyncHttpProviderConfig()
Return the AsyncHttpProviderConfig

Returns:
the AsyncHttpProviderConfig

getRealm

public Realm getRealm()
Return the current Realm}

Returns:
the current Realm}

getRequestFilters

public List<RequestFilter> getRequestFilters()
Return the list of RequestFilter

Returns:
Unmodifiable list of ResponseFilter

getResponseFilters

public List<ResponseFilter> getResponseFilters()
Return the list of ResponseFilter

Returns:
Unmodifiable list of ResponseFilter

getIOExceptionFilters

public List<IOExceptionFilter> getIOExceptionFilters()
Return the list of IOException

Returns:
Unmodifiable list of IOException

getRequestCompressionLevel

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

getMaxRequestRetry

public int getMaxRequestRetry()
Return the number of time the library will retry when an IOException is throw by the remote server

Returns:
the number of time the library will retry when an IOException is throw by the remote server

isSslConnectionPoolEnabled

public boolean isSslConnectionPoolEnabled()
Return true is SSL connection polling is enabled. Default is true.

Returns:
true is enabled.

isDisableUrlEncodingForBoundedRequests

public boolean isDisableUrlEncodingForBoundedRequests()
Returns:
the disableUrlEncodingForBoundedRequests

isRemoveQueryParamOnRedirect

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.

isValid

public boolean isValid()
Returns:
true if both the application and reaper thread pools haven't yet been shutdown.
Since:
1.7.21

getHostnameVerifier

public HostnameVerifier getHostnameVerifier()
Return the HostnameVerifier

Returns:
the HostnameVerifier

getIoThreadMultiplier

public int getIoThreadMultiplier()
Returns:
number to multiply by availableProcessors() that will determine # of NioWorkers to use

isStrict302Handling

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.
Since:
1.7.2

isUseRelativeURIsWithSSLProxies

public boolean isUseRelativeURIsWithSSLProxies()
Since:
1.7.12

getMaxConnectionLifeTimeInMs

public int getMaxConnectionLifeTimeInMs()
Return the maximum time in millisecond an AsyncHttpClient will keep connection in the pool, or -1 to keep connection while possible.

Returns:
the maximum time in millisecond an AsyncHttpClient will keep connection in the pool, or -1 to keep connection while possible.

getTimeConverter

public TimeConverter getTimeConverter()
since 1.8.2


isAcceptAnyCertificate

public boolean isAcceptAnyCertificate()
since 1.9.0



Copyright © 2014. All Rights Reserved.