com.ning.http.client
Class AsyncHttpClientConfig.Builder

java.lang.Object
  extended by com.ning.http.client.AsyncHttpClientConfig.Builder
Enclosing class:
AsyncHttpClientConfig

public static class AsyncHttpClientConfig.Builder
extends Object

Builder for an AsyncHttpClient


Constructor Summary
AsyncHttpClientConfig.Builder()
           
 
Method Summary
 AsyncHttpClientConfig build()
          Build an AsyncHttpClientConfig
 AsyncHttpClientConfig.Builder setAsyncHttpClientProviderConfig(AsyncHttpProviderConfig<?,?> providerConfig)
          Set the AsyncHttpProviderConfig
 AsyncHttpClientConfig.Builder setCompressionEnabled(boolean compressionEnabled)
          Enable HTTP compression.
 AsyncHttpClientConfig.Builder setConnectionsPool(ConnectionsPool<?,?> connectionsPool)
          Set the AsyncHttpProviderConfig
 AsyncHttpClientConfig.Builder setConnectionTimeoutInMs(int defaultConnectionTimeOutInMs)
          Set the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host
 AsyncHttpClientConfig.Builder setExecutorService(ExecutorService applicationThreadPool)
          Set the ExecutorService an AsyncHttpClient use for handling asynchronous response.
 AsyncHttpClientConfig.Builder setFollowRedirects(boolean redirectEnabled)
          Set to true to enable HTTP redirect
 AsyncHttpClientConfig.Builder setIdleConnectionTimeoutInMs(int defaultIdleConnectionTimeoutInMs)
          Set the maximum time in millisecond an AsyncHttpClient can stay idle.
 AsyncHttpClientConfig.Builder setKeepAlive(boolean keepAlive)
          Set HTTP keep-alive value.
 AsyncHttpClientConfig.Builder setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost)
          Set the maximum number of connections per hosts an AsyncHttpClient can handle.
 AsyncHttpClientConfig.Builder setMaximumConnectionsTotal(int defaultMaxTotalConnections)
          Set the maximum number of connections an AsyncHttpClient can handle.
 AsyncHttpClientConfig.Builder setMaximumNumberOfRedirects(int maxDefaultRedirects)
          Set the maximum number of HTTP redirect
 AsyncHttpClientConfig.Builder setProxyServer(ProxyServer proxyServer)
          Set an instance of ProxyServer used by an AsyncHttpClient
 AsyncHttpClientConfig.Builder setRealm(Realm realm)
          Set the Realm that will be used for all requests.
 AsyncHttpClientConfig.Builder setRequestTimeoutInMs(int defaultRequestTimeoutInMs)
          Set the maximum time in millisecond an AsyncHttpClient wait for a response
 AsyncHttpClientConfig.Builder setScheduledExecutorService(ScheduledExecutorService reaper)
          Set theScheduledExecutorService used to expire idle connections.
 AsyncHttpClientConfig.Builder setSSLContext(SSLContext sslContext)
          Set the SSLContext for secure connection.
 AsyncHttpClientConfig.Builder setSSLEngineFactory(SSLEngineFactory sslEngineFactory)
          Set the SSLEngineFactory for secure connection.
 AsyncHttpClientConfig.Builder setUserAgent(String userAgent)
          Set the USER_AGENT header value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncHttpClientConfig.Builder

public AsyncHttpClientConfig.Builder()
Method Detail

setMaximumConnectionsTotal

public AsyncHttpClientConfig.Builder setMaximumConnectionsTotal(int defaultMaxTotalConnections)
Set the maximum number of connections an AsyncHttpClient can handle.

Parameters:
defaultMaxTotalConnections - the maximum number of connections an AsyncHttpClient can handle.
Returns:
a AsyncHttpClientConfig.Builder

setMaximumConnectionsPerHost

public AsyncHttpClientConfig.Builder setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost)
Set the maximum number of connections per hosts an AsyncHttpClient can handle.

Parameters:
defaultMaxConnectionPerHost - the maximum number of connections per host an AsyncHttpClient can handle.
Returns:
a AsyncHttpClientConfig.Builder

setConnectionTimeoutInMs

public AsyncHttpClientConfig.Builder setConnectionTimeoutInMs(int defaultConnectionTimeOutInMs)
Set the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host

Parameters:
defaultConnectionTimeOutInMs - the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote host
Returns:
a AsyncHttpClientConfig.Builder

setIdleConnectionTimeoutInMs

public AsyncHttpClientConfig.Builder setIdleConnectionTimeoutInMs(int defaultIdleConnectionTimeoutInMs)
Set the maximum time in millisecond an AsyncHttpClient can stay idle.

Parameters:
defaultIdleConnectionTimeoutInMs - the maximum time in millisecond an AsyncHttpClient can stay idle.
Returns:
a AsyncHttpClientConfig.Builder

setRequestTimeoutInMs

public AsyncHttpClientConfig.Builder setRequestTimeoutInMs(int defaultRequestTimeoutInMs)
Set the maximum time in millisecond an AsyncHttpClient wait for a response

Parameters:
defaultRequestTimeoutInMs - the maximum time in millisecond an AsyncHttpClient wait for a response
Returns:
a AsyncHttpClientConfig.Builder

setFollowRedirects

public AsyncHttpClientConfig.Builder setFollowRedirects(boolean redirectEnabled)
Set to true to enable HTTP redirect

Parameters:
redirectEnabled - true if enabled.
Returns:
a AsyncHttpClientConfig.Builder

setMaximumNumberOfRedirects

public AsyncHttpClientConfig.Builder setMaximumNumberOfRedirects(int maxDefaultRedirects)
Set the maximum number of HTTP redirect

Parameters:
maxDefaultRedirects - the maximum number of HTTP redirect
Returns:
a AsyncHttpClientConfig.Builder

setCompressionEnabled

public AsyncHttpClientConfig.Builder setCompressionEnabled(boolean compressionEnabled)
Enable HTTP compression.

Parameters:
compressionEnabled - true if compression is enabled
Returns:
a AsyncHttpClientConfig.Builder

setUserAgent

public AsyncHttpClientConfig.Builder setUserAgent(String userAgent)
Set the USER_AGENT header value

Parameters:
userAgent - the USER_AGENT header value
Returns:
a AsyncHttpClientConfig.Builder

setKeepAlive

public AsyncHttpClientConfig.Builder setKeepAlive(boolean keepAlive)
Set HTTP keep-alive value.

Parameters:
keepAlive - true if keep-alive is enabled
Returns:
a AsyncHttpClientConfig.Builder

setScheduledExecutorService

public AsyncHttpClientConfig.Builder setScheduledExecutorService(ScheduledExecutorService reaper)
Set theScheduledExecutorService used to expire idle connections.

Parameters:
reaper - theScheduledExecutorService used to expire idle connections.
Returns:
a AsyncHttpClientConfig.Builder

setExecutorService

public AsyncHttpClientConfig.Builder setExecutorService(ExecutorService applicationThreadPool)
Set the ExecutorService an AsyncHttpClient use for handling asynchronous response.

Parameters:
applicationThreadPool - the ExecutorService an AsyncHttpClient use for handling asynchronous response.
Returns:
a AsyncHttpClientConfig.Builder

setProxyServer

public AsyncHttpClientConfig.Builder setProxyServer(ProxyServer proxyServer)
Set an instance of ProxyServer used by an AsyncHttpClient

Parameters:
proxyServer - instance of ProxyServer
Returns:
a AsyncHttpClientConfig.Builder

setSSLEngineFactory

public AsyncHttpClientConfig.Builder setSSLEngineFactory(SSLEngineFactory sslEngineFactory)
Set the SSLEngineFactory for secure connection.

Parameters:
sslEngineFactory - the SSLEngineFactory for secure connection
Returns:
a AsyncHttpClientConfig.Builder

setSSLContext

public AsyncHttpClientConfig.Builder setSSLContext(SSLContext sslContext)
Set the SSLContext for secure connection.

Parameters:
sslContext - the SSLContext for secure connection
Returns:
a AsyncHttpClientConfig.Builder

setAsyncHttpClientProviderConfig

public AsyncHttpClientConfig.Builder setAsyncHttpClientProviderConfig(AsyncHttpProviderConfig<?,?> providerConfig)
Set the AsyncHttpProviderConfig

Parameters:
providerConfig -
Returns:
a AsyncHttpClientConfig.Builder

setConnectionsPool

public AsyncHttpClientConfig.Builder setConnectionsPool(ConnectionsPool<?,?> connectionsPool)
Set the AsyncHttpProviderConfig

Parameters:
connectionsPool -
Returns:
a AsyncHttpClientConfig.Builder

setRealm

public AsyncHttpClientConfig.Builder setRealm(Realm realm)
Set the Realm that will be used for all requests.

Parameters:
realm - the Realm
Returns:
a AsyncHttpClientConfig.Builder

build

public AsyncHttpClientConfig build()
Build an AsyncHttpClientConfig

Returns:
an AsyncHttpClientConfig


Copyright © 2010. All Rights Reserved.