public static class RxHttpClient.Builder
extends java.lang.Object
RxHttpClient builders.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
RxHttpClient.Builder |
addRequestSigner(RequestSigner requestSigner) |
RxHttpClient |
build() |
RxHttpClient.Builder |
setAccept(java.lang.String acceptHeaderValue)
Sets the default Accept request-header for requests built using this instance.
|
RxHttpClient.Builder |
setAcceptAnyCertificate(boolean acceptAnyCertificate) |
RxHttpClient.Builder |
setAllowPoolingConnections(boolean allowPoolingConnections)
Set true if connection can be pooled by a ChannelPool.
|
RxHttpClient.Builder |
setAllowPoolingSslConnections(boolean allowPoolingSslConnections)
Set whether connections pooling is enabled.
|
RxHttpClient.Builder |
setAwsCredentialsProvider(AwsCredentialsProvider provider) |
RxHttpClient.Builder |
setAwsEndPoint(AwsService service,
AwsRegion region) |
RxHttpClient.Builder |
setAwsEndPoint(AwsService service,
AwsRegion region,
java.lang.String domain) |
RxHttpClient.Builder |
setBaseUrl(java.lang.String url)
Sets the base URL for this client.
|
RxHttpClient.Builder |
setCompressionEnforced(boolean compressionEnforced)
Enforce HTTP compression.
|
RxHttpClient.Builder |
setConnectionTTL(int connectionTTL)
Set the maximum time in millisecond connection can be added to the pool for further reuse
|
RxHttpClient.Builder |
setConnectTimeout(int connectTimeOut)
Set the maximum time in millisecond an
AsyncHttpClient can wait when connecting to a remote host |
RxHttpClient.Builder |
setDisableUrlEncodingForBoundedRequests(boolean disableUrlEncodingForBoundedRequests)
Disable automatic url escaping
|
RxHttpClient.Builder |
setEnabledCipherSuites(java.lang.String[] enabledCipherSuites) |
RxHttpClient.Builder |
setEnabledProtocols(java.lang.String[] enabledProtocols) |
RxHttpClient.Builder |
setExecutorService(java.util.concurrent.ExecutorService applicationThreadPool)
Set the
ExecutorService an AsyncHttpClient use for handling
asynchronous response. |
RxHttpClient.Builder |
setFollowRedirect(boolean followRedirect)
Set to true to enable HTTP redirect
|
RxHttpClient.Builder |
setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
Set the
HostnameVerifier |
RxHttpClient.Builder |
setIOThreadMultiplier(int multiplier) |
RxHttpClient.Builder |
setMaxConnections(int maxConnections)
Set the maximum number of connections an
AsyncHttpClient can handle. |
RxHttpClient.Builder |
setMaxRedirects(int maxRedirects)
Set the maximum number of HTTP redirect
|
RxHttpClient.Builder |
setMaxRequestRetry(int maxRequestRetry)
Set the number of time a request will be retried when an
IOException occurs because of a Network exception. |
RxHttpClient.Builder |
setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout)
Set the maximum time in millisecond an
AsyncHttpClient will keep connection
idle in pool. |
RxHttpClient.Builder |
setReadTimeout(int readTimeout)
Set the maximum time in millisecond an
AsyncHttpClient can stay idle. |
RxHttpClient.Builder |
setRequestTimeout(int requestTimeout)
Set the maximum time in millisecond an
AsyncHttpClient waits until the response is completed. |
RxHttpClient.Builder |
setSSLContext(javax.net.ssl.SSLContext sslContext)
Set the
SSLContext for secure connection. |
RxHttpClient.Builder |
setStrict302Handling(boolean strict302Handling)
Configures this AHC instance to be strict in it's handling of 302 redirects
in a POST/Redirect/GET situation.
|
RxHttpClient.Builder |
setThrottling(int maxWait)
Throttles requests by blocking until connections in the pool become available, waiting for
the response to arrives before executing the next request.
|
RxHttpClient.Builder |
setUseProxyProperties(boolean useProxyProperties)
Sets whether AHC should use the default http.proxy* system properties
to obtain proxy information.
|
RxHttpClient.Builder |
setUseProxySelector(boolean useProxySelector)
Sets whether AHC should use the default JDK ProxySelector to select a proxy server.
|
RxHttpClient.Builder |
setUserAgent(java.lang.String userAgent)
Set the USER_AGENT header value
|
RxHttpClient.Builder |
setUseRelativeURIsWithConnectProxies(boolean useRelativeURIsWithConnectProxies)
Configures this AHC instance to use relative URIs instead of absolute ones when talking with a SSL proxy or WebSocket proxy.
|
RxHttpClient.Builder |
setWebSocketTimeout(int webSocketTimeout)
Set the maximum time in millisecond an
WebSocket can stay idle. |
public RxHttpClient build()
public RxHttpClient.Builder addRequestSigner(RequestSigner requestSigner)
public RxHttpClient.Builder setAccept(java.lang.String acceptHeaderValue)
acceptHeaderValue - the Media-range and accept-params to use as value for the Accept request-header fieldpublic RxHttpClient.Builder setBaseUrl(java.lang.String url)
The base url will be prepended to any relative URL path specified in the RequestBuilder
url - the base URL for this instancepublic RxHttpClient.Builder setMaxConnections(int maxConnections)
AsyncHttpClient can handle.maxConnections - the maximum number of connections an AsyncHttpClient can handle.RxHttpClient.Builderpublic RxHttpClient.Builder setAllowPoolingConnections(boolean allowPoolingConnections)
allowPoolingConnections - true if connection can be pooled by a ChannelPoolRxHttpClient.Builderpublic RxHttpClient.Builder setThrottling(int maxWait)
maxWait - timeout in milliscecondspublic RxHttpClient.Builder setConnectTimeout(int connectTimeOut)
AsyncHttpClient can wait when connecting to a remote hostconnectTimeOut - the maximum time in millisecond an AsyncHttpClient can wait when connecting to a remote hostRxHttpClient.Builderpublic RxHttpClient.Builder setExecutorService(java.util.concurrent.ExecutorService applicationThreadPool)
ExecutorService an AsyncHttpClient use for handling
asynchronous response.
By default a Cached Threadpool will be used, that will create threads as needed (see Executors.newCachedThreadPool())
applicationThreadPool - the ExecutorService an AsyncHttpClient use for handling
asynchronous response.RxHttpClient.Builderpublic RxHttpClient.Builder setWebSocketTimeout(int webSocketTimeout)
WebSocket can stay idle.webSocketTimeout - the maximum time in millisecond an WebSocket can stay idle.RxHttpClient.Builderpublic RxHttpClient.Builder setMaxRequestRetry(int maxRequestRetry)
IOException occurs because of a Network exception.maxRequestRetry - the number of time a request will be retriedpublic RxHttpClient.Builder setHostnameVerifier(javax.net.ssl.HostnameVerifier hostnameVerifier)
HostnameVerifierhostnameVerifier - HostnameVerifierpublic RxHttpClient.Builder setEnabledProtocols(java.lang.String[] enabledProtocols)
public RxHttpClient.Builder setUseRelativeURIsWithConnectProxies(boolean useRelativeURIsWithConnectProxies)
useRelativeURIsWithConnectProxies - use relative URIs with connect proxiespublic RxHttpClient.Builder setEnabledCipherSuites(java.lang.String[] enabledCipherSuites)
public RxHttpClient.Builder setAllowPoolingSslConnections(boolean allowPoolingSslConnections)
Default is set to true
allowPoolingSslConnections - true if enabledpublic RxHttpClient.Builder setUseProxyProperties(boolean useProxyProperties)
setUseProxySelector(boolean)
in that AsyncHttpClient will use its own logic to handle the system properties,
potentially supporting other protocols that the the JDK ProxySelector doesn't.
If useProxyProperties is set to true but setUseProxySelector(boolean)
was also set to true, the latter is preferred.
See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html
useProxyProperties - whether AHC should use the default http.proxy* system propertiespublic RxHttpClient.Builder setUseProxySelector(boolean useProxySelector)
See http://docs.oracle.com/javase/7/docs/api/java/net/ProxySelector.html
useProxySelector - whether AHC should use the default JDK ProxySelector to select a proxy server.public RxHttpClient.Builder setMaxRedirects(int maxRedirects)
maxRedirects - the maximum number of HTTP redirectRxHttpClient.Builderpublic RxHttpClient.Builder setAcceptAnyCertificate(boolean acceptAnyCertificate)
public RxHttpClient.Builder setIOThreadMultiplier(int multiplier)
public RxHttpClient.Builder setStrict302Handling(boolean strict302Handling)
strict302Handling - strict handlingpublic RxHttpClient.Builder setConnectionTTL(int connectionTTL)
Default is -1 (no TTL set)
connectionTTL - the maximum time in millisecond connection can be added to the pool for further reuseRxHttpClient.Builderpublic RxHttpClient.Builder setUserAgent(java.lang.String userAgent)
userAgent - the USER_AGENT header valueRxHttpClient.Builderpublic RxHttpClient.Builder setFollowRedirect(boolean followRedirect)
followRedirect@return - a RxHttpClient.Builderpublic RxHttpClient.Builder setDisableUrlEncodingForBoundedRequests(boolean disableUrlEncodingForBoundedRequests)
disableUrlEncodingForBoundedRequests - disables the url encoding if set to truepublic RxHttpClient.Builder setRequestTimeout(int requestTimeout)
AsyncHttpClient waits until the response is completed.requestTimeout - the maximum time in millisecond an AsyncHttpClient waits until the response is completed.RxHttpClient.Builderpublic RxHttpClient.Builder setSSLContext(javax.net.ssl.SSLContext sslContext)
SSLContext for secure connection.sslContext - the SSLContext for secure connectionRxHttpClient.Builderpublic RxHttpClient.Builder setCompressionEnforced(boolean compressionEnforced)
compressionEnforced - true if compression is enforcedRxHttpClient.Builderpublic RxHttpClient.Builder setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout)
AsyncHttpClient will keep connection
idle in pool.
Default is 60000 millis (1 min.)
pooledConnectionIdleTimeout@return - a RxHttpClient.Builderpublic RxHttpClient.Builder setReadTimeout(int readTimeout)
AsyncHttpClient can stay idle.readTimeout - the maximum time in millisecond an RestClient can stay idle.RxHttpClient.Builderpublic RxHttpClient.Builder setAwsEndPoint(AwsService service, AwsRegion region)
public RxHttpClient.Builder setAwsEndPoint(AwsService service, AwsRegion region, java.lang.String domain)
public RxHttpClient.Builder setAwsCredentialsProvider(AwsCredentialsProvider provider)