Package com.ning.http.client
Class SimpleAsyncHttpClient.Builder
java.lang.Object
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBodyPart(Part part) addFormParam(String key, String value) addQueryParam(String name, String value) build()setAcceptAnyCertificate(boolean acceptAnyCertificate) setAllowPoolingConnections(boolean allowPoolingConnections) setCompressionEnforced(boolean compressionEnabled) setConnectTimeout(int connectTimeout) setDefaultThrowableHandler(ThrowableHandler throwableHandler) This setting controls whether an error document should be written via theBodyConsumerafter an error status code was received (e.g.setExecutorService(ExecutorService applicationThreadPool) setFollowRedirects(boolean followRedirects) setFormParams(List<Param> params) setFormParams(Map<String, List<String>> params) setHeaders(Map<String, Collection<String>> headers) setListener(SimpleAHCTransferListener listener) Set the listener to notify about connection progress.setMaximumConnectionsPerHost(int defaultMaxConnectionPerHost) setMaximumConnectionsTotal(int defaultMaxTotalConnections) setMaximumNumberOfRedirects(int maxDefaultRedirects) setMaxRequestRetry(int maxRequestRetry) Set the number of time a request will be retried when anIOExceptionoccurs because of a Network exception.setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout) setProviderClass(String providerClass) setProxyHost(String host) setProxyPassword(String password) setProxyPort(int port) setProxyPrincipal(String principal) setProxyProtocol(ProxyServer.Protocol protocol) setRealmCharset(Charset charset) setRealmName(String realmName) setRealmNtlmDomain(String ntlmDomain) setRealmPassword(String password) setRealmPrincipal(String principal) setRealmScheme(Realm.AuthScheme scheme) setRealmUsePreemptiveAuth(boolean usePreemptiveAuth) setRequestTimeout(int defaultRequestTimeout) setResumableDownload(boolean enableResumableDownload) Enable resumable downloads for the SimpleAHC.setSSLContext(SSLContext sslContext) setUserAgent(String userAgent) setVirtualHost(String virtualHost)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addBodyPart
- Specified by:
addBodyPartin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
addCookie
- Specified by:
addCookiein interfaceSimpleAsyncHttpClient.DerivedBuilder
-
addHeader
- Specified by:
addHeaderin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
addFormParam
- Specified by:
addFormParamin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
addQueryParam
- Specified by:
addQueryParamin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setHeader
- Specified by:
setHeaderin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setHeaders
- Specified by:
setHeadersin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setHeaders
- Specified by:
setHeadersin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setFormParams
- Specified by:
setFormParamsin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setFormParams
- Specified by:
setFormParamsin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setUrl
- Specified by:
setUrlin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setVirtualHost
- Specified by:
setVirtualHostin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setFollowRedirects
- Specified by:
setFollowRedirectsin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setMaximumConnectionsTotal
-
setMaximumConnectionsPerHost
-
setConnectTimeout
-
setPooledConnectionIdleTimeout
public SimpleAsyncHttpClient.Builder setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout) -
setRequestTimeout
-
setMaximumNumberOfRedirects
-
setCompressionEnforced
-
setUserAgent
-
setAllowPoolingConnections
-
setExecutorService
-
setSSLContext
-
setRealmNtlmDomain
-
setRealmPrincipal
-
setRealmPassword
-
setRealmScheme
-
setRealmName
-
setRealmUsePreemptiveAuth
-
setRealmCharset
-
setProxyProtocol
-
setProxyHost
-
setProxyPrincipal
-
setProxyPassword
-
setProxyPort
-
setDefaultThrowableHandler
-
setErrorDocumentBehaviour
public SimpleAsyncHttpClient.Builder setErrorDocumentBehaviour(SimpleAsyncHttpClient.ErrorDocumentBehaviour behaviour) This setting controls whether an error document should be written via theBodyConsumerafter an error status code was received (e.g. 404). Default isSimpleAsyncHttpClient.ErrorDocumentBehaviour.WRITE. -
setResumableDownload
Enable resumable downloads for the SimpleAHC. Resuming downloads will only work for GET requests with an instance ofResumableBodyConsumer.- Specified by:
setResumableDownloadin interfaceSimpleAsyncHttpClient.DerivedBuilder
-
setListener
Set the listener to notify about connection progress. -
setMaxRequestRetry
Set the number of time a request will be retried when anIOExceptionoccurs because of a Network exception.- Parameters:
maxRequestRetry- the number of time a request will be retried- Returns:
- this
-
setProviderClass
-
setAcceptAnyCertificate
-
build
- Specified by:
buildin interfaceSimpleAsyncHttpClient.DerivedBuilder
-