public static class RxHttpClient.Builder
extends java.lang.Object
RxHttpClient builders.| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
RxHttpClient |
build() |
RxHttpClient.Builder |
setAccept(java.lang.String acceptHeaderValue) |
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)
Return true is if connections pooling is enabled.
|
RxHttpClient.Builder |
setBaseUrl(java.lang.String url) |
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 |
setMaxConnectionsPerHost(int maxConnectionsPerHost)
Set the maximum number of connections per hosts 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 |
setRemoveQueryParamsOnRedirect(boolean removeQueryParamOnRedirect)
Set to false if you don't want the query parameters removed when a redirect occurs.
|
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 |
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 setAccept(java.lang.String acceptHeaderValue)
public RxHttpClient.Builder setBaseUrl(java.lang.String url)
public 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 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.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 setMaxConnectionsPerHost(int maxConnectionsPerHost)
AsyncHttpClient can handle.maxConnectionsPerHost - the maximum number of connections per host an AsyncHttpClient can handle.RxHttpClient.Builderpublic RxHttpClient.Builder setEnabledCipherSuites(java.lang.String[] enabledCipherSuites)
public RxHttpClient.Builder setAllowPoolingSslConnections(boolean allowPoolingSslConnections)
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 - public RxHttpClient.Builder setUseProxySelector(boolean useProxySelector)
See http://docs.oracle.com/javase/7/docs/api/java/net/ProxySelector.html
useProxySelector - 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)
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 setRemoveQueryParamsOnRedirect(boolean removeQueryParamOnRedirect)
removeQueryParamOnRedirect - public RxHttpClient.Builder setDisableUrlEncodingForBoundedRequests(boolean disableUrlEncodingForBoundedRequests)
disableUrlEncodingForBoundedRequests - public 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.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.Builder