public final class HttpClient4ClientFactoryBuilder extends Object
Constructs a configured HttpClient4ClientFactory. Supports construction in
code using the builder pattern (starting with httpClient4ClientFactory())
and usage as a Spring bean factory. For example:
<bean id="httpClient4ClientFactoryBuilder" class="HttpClient4ClientFactoryBuilder">
<property name="maxConnections">20</property>
</bean>
<bean id="httpClient4ClientFactory"
factory-bean="httpClient4ClientFactoryBuilder"
factory-method="build"/>
See static fields of HttpClient4ClientFactory for the default settings applied if methods in this builder are
not used to override them.
| Constructor and Description |
|---|
HttpClient4ClientFactoryBuilder() |
| Modifier and Type | Method and Description |
|---|---|
HttpClient4ClientFactory |
build()
Builds an immutable
HttpClient4ClientFactory instance with the configuration supplied. |
static HttpClient4ClientFactoryBuilder |
httpClient4ClientFactory()
Static builder method for method chaining, fluent builder style.
|
void |
setAllowRedirects(boolean allowRedirects)
Set whether redirects should be followed.
|
void |
setConnectionManagerTimeoutMs(int connectionManagerTimeoutMs)
Sets the connection manager timeout in milliseconds.
|
void |
setConnectionTimeoutMs(int connectionTimeoutMs)
Set the time in milliseconds to wait for a connection to be established before aborting the request.
|
void |
setMaxConnections(int maxConnections)
Set the maximum total connections allowed across all routes.
|
void |
setMaxConnectionsPerRoute(int maxConnectionsPerRoute)
Set the maximum connections allowed per route.
|
void |
setSocketTimeoutMs(int socketTimeoutMs)
Maximum time of inactivity to allow between two consecutive data packets from the server before aborting the
request.
|
HttpClient4ClientFactoryBuilder |
withAllowRedirects(boolean allowRedirects)
Set whether redirects should be followed.
|
HttpClient4ClientFactoryBuilder |
withConnectionManagerTimeoutMs(int connectionManagerTimeoutMs)
Sets the connection manager timeout in milliseconds.
|
HttpClient4ClientFactoryBuilder |
withConnectionTimeoutMs(int connectionTimeoutMs)
Set the time in milliseconds to wait for a connection to be established before aborting the request.
|
HttpClient4ClientFactoryBuilder |
withMaxConnections(int maxConnections)
Set the maximum total connections allowed across all routes.
|
HttpClient4ClientFactoryBuilder |
withMaxConnectionsPerRoute(int maxConnectionsPerRoute)
Set the maximum connections allowed per route.
|
HttpClient4ClientFactoryBuilder |
withSocketTimeoutMs(int socketTimeoutMs)
Maximum time of inactivity to allow between two consecutive data packets from the server before aborting the
request.
|
public static HttpClient4ClientFactoryBuilder httpClient4ClientFactory()
HttpClient4ClientFactoryBuilder instance.public void setMaxConnections(int maxConnections)
maxConnections - maximum total connections allowed for all routes.public void setMaxConnectionsPerRoute(int maxConnectionsPerRoute)
maxConnectionsPerRoute - maximum connections allowed per route.public void setConnectionManagerTimeoutMs(int connectionManagerTimeoutMs)
connectionManagerTimeoutMs - connection manager timeout in milliseconds.public void setConnectionTimeoutMs(int connectionTimeoutMs)
connectionTimeoutMs - connection timeout in milliseconds.public void setSocketTimeoutMs(int socketTimeoutMs)
socketTimeoutMs - socket timeout in milliseconds.public void setAllowRedirects(boolean allowRedirects)
allowRedirects - whether redirects should be followed.public HttpClient4ClientFactoryBuilder withMaxConnections(int maxConnections)
maxConnections - maximum total connections allowed for all routes.public HttpClient4ClientFactoryBuilder withMaxConnectionsPerRoute(int maxConnectionsPerRoute)
maxConnectionsPerRoute - maximum connections allowed per route.public HttpClient4ClientFactoryBuilder withConnectionManagerTimeoutMs(int connectionManagerTimeoutMs)
connectionManagerTimeoutMs - connection manager timeout in milliseconds.public HttpClient4ClientFactoryBuilder withConnectionTimeoutMs(int connectionTimeoutMs)
connectionTimeoutMs - connection timeout in milliseconds.public HttpClient4ClientFactoryBuilder withSocketTimeoutMs(int socketTimeoutMs)
socketTimeoutMs - socket timeout in milliseconds.public HttpClient4ClientFactoryBuilder withAllowRedirects(boolean allowRedirects)
allowRedirects - whether redirects should be followed.public HttpClient4ClientFactory build()
HttpClient4ClientFactory instance with the configuration supplied.HttpClient4ClientFactory instance.Copyright © 2014. All Rights Reserved.