com.ning.http.client
Class SimpleAsyncHttpClient.Builder

java.lang.Object
  extended by com.ning.http.client.SimpleAsyncHttpClient.Builder
All Implemented Interfaces:
SimpleAsyncHttpClient.DerivedBuilder
Enclosing class:
SimpleAsyncHttpClient

public static final class SimpleAsyncHttpClient.Builder
extends Object
implements SimpleAsyncHttpClient.DerivedBuilder


Constructor Summary
SimpleAsyncHttpClient.Builder()
           
 
Method Summary
 SimpleAsyncHttpClient.Builder addBodyPart(Part part)
           
 SimpleAsyncHttpClient.Builder addCookie(Cookie cookie)
           
 SimpleAsyncHttpClient.Builder addHeader(String name, String value)
           
 SimpleAsyncHttpClient.Builder addParameter(String key, String value)
           
 SimpleAsyncHttpClient.Builder addQueryParameter(String name, String value)
           
 SimpleAsyncHttpClient build()
           
 SimpleAsyncHttpClient.Builder setAllowPoolingConnection(boolean allowPoolingConnection)
           
 SimpleAsyncHttpClient.Builder setCompressionEnabled(boolean compressionEnabled)
           
 SimpleAsyncHttpClient.Builder setConnectionTimeoutInMs(int connectionTimeuot)
           
 SimpleAsyncHttpClient.Builder setDefaultThrowableHandler(ThrowableHandler throwableHandler)
           
 SimpleAsyncHttpClient.Builder setErrorDocumentBehaviour(SimpleAsyncHttpClient.ErrorDocumentBehaviour behaviour)
          This setting controls whether an error document should be written via the BodyConsumer after an error status code was received (e.g.
 SimpleAsyncHttpClient.Builder setExecutorService(ExecutorService applicationThreadPool)
           
 SimpleAsyncHttpClient.Builder setFollowRedirects(boolean followRedirects)
           
 SimpleAsyncHttpClient.Builder setHeader(String name, String value)
           
 SimpleAsyncHttpClient.Builder setHeaders(FluentCaseInsensitiveStringsMap headers)
           
 SimpleAsyncHttpClient.Builder setHeaders(Map<String,Collection<String>> headers)
           
 SimpleAsyncHttpClient.Builder setIdleConnectionInPoolTimeoutInMs(int defaultIdleConnectionInPoolTimeoutInMs)
           
 SimpleAsyncHttpClient.Builder setListener(SimpleAHCTransferListener listener)
          Set the listener to notify about connection progress.
 SimpleAsyncHttpClient.Builder setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost)
           
 SimpleAsyncHttpClient.Builder setMaximumConnectionsTotal(int defaultMaxTotalConnections)
           
 SimpleAsyncHttpClient.Builder setMaximumNumberOfRedirects(int maxDefaultRedirects)
           
 SimpleAsyncHttpClient.Builder setMaxRequestRetry(int maxRequestRetry)
          Set the number of time a request will be retried when an IOException occurs because of a Network exception.
 SimpleAsyncHttpClient.Builder setParameters(FluentStringsMap parameters)
           
 SimpleAsyncHttpClient.Builder setParameters(Map<String,Collection<String>> parameters)
           
 SimpleAsyncHttpClient.Builder setProxyHost(String host)
           
 SimpleAsyncHttpClient.Builder setProxyPassword(String password)
           
 SimpleAsyncHttpClient.Builder setProxyPort(int port)
           
 SimpleAsyncHttpClient.Builder setProxyPrincipal(String principal)
           
 SimpleAsyncHttpClient.Builder setProxyProtocol(ProxyServer.Protocol protocol)
           
 SimpleAsyncHttpClient.Builder setRealmDomain(String domain)
           
 SimpleAsyncHttpClient.Builder setRealmEnconding(String enc)
           
 SimpleAsyncHttpClient.Builder setRealmName(String realmName)
           
 SimpleAsyncHttpClient.Builder setRealmPassword(String password)
           
 SimpleAsyncHttpClient.Builder setRealmPrincipal(String principal)
           
 SimpleAsyncHttpClient.Builder setRealmScheme(Realm.AuthScheme scheme)
           
 SimpleAsyncHttpClient.Builder setRealmUsePreemptiveAuth(boolean usePreemptiveAuth)
           
 SimpleAsyncHttpClient.Builder setRequestCompressionLevel(int requestCompressionLevel)
           
 SimpleAsyncHttpClient.Builder setRequestTimeoutInMs(int defaultRequestTimeoutInMs)
           
 SimpleAsyncHttpClient.Builder setResumableDownload(boolean enableResumableDownload)
          Enable resumable downloads for the SimpleAHC.
 SimpleAsyncHttpClient.Builder setScheduledExecutorService(ScheduledExecutorService reaper)
           
 SimpleAsyncHttpClient.Builder setSSLContext(SSLContext sslContext)
           
 SimpleAsyncHttpClient.Builder setSSLEngineFactory(SSLEngineFactory sslEngineFactory)
           
 SimpleAsyncHttpClient.Builder setUrl(String url)
           
 SimpleAsyncHttpClient.Builder setUserAgent(String userAgent)
           
 SimpleAsyncHttpClient.Builder setVirtualHost(String virtualHost)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAsyncHttpClient.Builder

public SimpleAsyncHttpClient.Builder()
Method Detail

addBodyPart

public SimpleAsyncHttpClient.Builder addBodyPart(Part part)
                                          throws IllegalArgumentException
Specified by:
addBodyPart in interface SimpleAsyncHttpClient.DerivedBuilder
Throws:
IllegalArgumentException

addCookie

public SimpleAsyncHttpClient.Builder addCookie(Cookie cookie)
Specified by:
addCookie in interface SimpleAsyncHttpClient.DerivedBuilder

addHeader

public SimpleAsyncHttpClient.Builder addHeader(String name,
                                               String value)
Specified by:
addHeader in interface SimpleAsyncHttpClient.DerivedBuilder

addParameter

public SimpleAsyncHttpClient.Builder addParameter(String key,
                                                  String value)
                                           throws IllegalArgumentException
Specified by:
addParameter in interface SimpleAsyncHttpClient.DerivedBuilder
Throws:
IllegalArgumentException

addQueryParameter

public SimpleAsyncHttpClient.Builder addQueryParameter(String name,
                                                       String value)
Specified by:
addQueryParameter in interface SimpleAsyncHttpClient.DerivedBuilder

setHeader

public SimpleAsyncHttpClient.Builder setHeader(String name,
                                               String value)
Specified by:
setHeader in interface SimpleAsyncHttpClient.DerivedBuilder

setHeaders

public SimpleAsyncHttpClient.Builder setHeaders(FluentCaseInsensitiveStringsMap headers)
Specified by:
setHeaders in interface SimpleAsyncHttpClient.DerivedBuilder

setHeaders

public SimpleAsyncHttpClient.Builder setHeaders(Map<String,Collection<String>> headers)
Specified by:
setHeaders in interface SimpleAsyncHttpClient.DerivedBuilder

setParameters

public SimpleAsyncHttpClient.Builder setParameters(Map<String,Collection<String>> parameters)
                                            throws IllegalArgumentException
Specified by:
setParameters in interface SimpleAsyncHttpClient.DerivedBuilder
Throws:
IllegalArgumentException

setParameters

public SimpleAsyncHttpClient.Builder setParameters(FluentStringsMap parameters)
                                            throws IllegalArgumentException
Specified by:
setParameters in interface SimpleAsyncHttpClient.DerivedBuilder
Throws:
IllegalArgumentException

setUrl

public SimpleAsyncHttpClient.Builder setUrl(String url)
Specified by:
setUrl in interface SimpleAsyncHttpClient.DerivedBuilder

setVirtualHost

public SimpleAsyncHttpClient.Builder setVirtualHost(String virtualHost)
Specified by:
setVirtualHost in interface SimpleAsyncHttpClient.DerivedBuilder

setFollowRedirects

public SimpleAsyncHttpClient.Builder setFollowRedirects(boolean followRedirects)
Specified by:
setFollowRedirects in interface SimpleAsyncHttpClient.DerivedBuilder

setMaximumConnectionsTotal

public SimpleAsyncHttpClient.Builder setMaximumConnectionsTotal(int defaultMaxTotalConnections)

setMaximumConnectionsPerHost

public SimpleAsyncHttpClient.Builder setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost)

setConnectionTimeoutInMs

public SimpleAsyncHttpClient.Builder setConnectionTimeoutInMs(int connectionTimeuot)

setIdleConnectionInPoolTimeoutInMs

public SimpleAsyncHttpClient.Builder setIdleConnectionInPoolTimeoutInMs(int defaultIdleConnectionInPoolTimeoutInMs)

setRequestTimeoutInMs

public SimpleAsyncHttpClient.Builder setRequestTimeoutInMs(int defaultRequestTimeoutInMs)

setMaximumNumberOfRedirects

public SimpleAsyncHttpClient.Builder setMaximumNumberOfRedirects(int maxDefaultRedirects)

setCompressionEnabled

public SimpleAsyncHttpClient.Builder setCompressionEnabled(boolean compressionEnabled)

setUserAgent

public SimpleAsyncHttpClient.Builder setUserAgent(String userAgent)

setAllowPoolingConnection

public SimpleAsyncHttpClient.Builder setAllowPoolingConnection(boolean allowPoolingConnection)

setScheduledExecutorService

public SimpleAsyncHttpClient.Builder setScheduledExecutorService(ScheduledExecutorService reaper)

setExecutorService

public SimpleAsyncHttpClient.Builder setExecutorService(ExecutorService applicationThreadPool)

setSSLEngineFactory

public SimpleAsyncHttpClient.Builder setSSLEngineFactory(SSLEngineFactory sslEngineFactory)

setSSLContext

public SimpleAsyncHttpClient.Builder setSSLContext(SSLContext sslContext)

setRequestCompressionLevel

public SimpleAsyncHttpClient.Builder setRequestCompressionLevel(int requestCompressionLevel)

setRealmDomain

public SimpleAsyncHttpClient.Builder setRealmDomain(String domain)

setRealmPrincipal

public SimpleAsyncHttpClient.Builder setRealmPrincipal(String principal)

setRealmPassword

public SimpleAsyncHttpClient.Builder setRealmPassword(String password)

setRealmScheme

public SimpleAsyncHttpClient.Builder setRealmScheme(Realm.AuthScheme scheme)

setRealmName

public SimpleAsyncHttpClient.Builder setRealmName(String realmName)

setRealmUsePreemptiveAuth

public SimpleAsyncHttpClient.Builder setRealmUsePreemptiveAuth(boolean usePreemptiveAuth)

setRealmEnconding

public SimpleAsyncHttpClient.Builder setRealmEnconding(String enc)

setProxyProtocol

public SimpleAsyncHttpClient.Builder setProxyProtocol(ProxyServer.Protocol protocol)

setProxyHost

public SimpleAsyncHttpClient.Builder setProxyHost(String host)

setProxyPrincipal

public SimpleAsyncHttpClient.Builder setProxyPrincipal(String principal)

setProxyPassword

public SimpleAsyncHttpClient.Builder setProxyPassword(String password)

setProxyPort

public SimpleAsyncHttpClient.Builder setProxyPort(int port)

setDefaultThrowableHandler

public SimpleAsyncHttpClient.Builder setDefaultThrowableHandler(ThrowableHandler throwableHandler)

setErrorDocumentBehaviour

public SimpleAsyncHttpClient.Builder setErrorDocumentBehaviour(SimpleAsyncHttpClient.ErrorDocumentBehaviour behaviour)
This setting controls whether an error document should be written via the BodyConsumer after an error status code was received (e.g. 404). Default is SimpleAsyncHttpClient.ErrorDocumentBehaviour.WRITE.


setResumableDownload

public SimpleAsyncHttpClient.Builder setResumableDownload(boolean enableResumableDownload)
Enable resumable downloads for the SimpleAHC. Resuming downloads will only work for GET requests with an instance of ResumableBodyConsumer.

Specified by:
setResumableDownload in interface SimpleAsyncHttpClient.DerivedBuilder

setListener

public SimpleAsyncHttpClient.Builder setListener(SimpleAHCTransferListener listener)
Set the listener to notify about connection progress.


setMaxRequestRetry

public SimpleAsyncHttpClient.Builder setMaxRequestRetry(int maxRequestRetry)
Set the number of time a request will be retried when an IOException occurs because of a Network exception.

Parameters:
maxRequestRetry - the number of time a request will be retried
Returns:
this

build

public SimpleAsyncHttpClient build()
Specified by:
build in interface SimpleAsyncHttpClient.DerivedBuilder


Copyright © 2011. All Rights Reserved.