public static final class HTTPClientConfig.Builder extends Object
HTTPClientConfig
.
The defaults are as follows:
field | default value |
---|---|
url | http://127.0.0.1:8098/riak (derived from defaults for scheme://host:port/path) |
scheme | http |
host | 127.0.0.1 |
port | 8098 |
path | riak |
mapreducePath | /mapred |
httpClient | null (IE the library creates one) |
timeout | null (will then use HttpClient default which is 0 (for infinite)) |
maxConnections | null (will then use the HttpClient default which is a max of *2*) |
httpRequestRetryHandler | null (will use the HttpClient default) |
Constructor and Description |
---|
HTTPClientConfig.Builder() |
Modifier and Type | Method and Description |
---|---|
HTTPClientConfig |
build() |
static HTTPClientConfig.Builder |
from(HTTPClientConfig copyConfig)
Create a new builder with values all copied from
copyConfig |
HTTPClientConfig.Builder |
withHost(String host)
Set the host.
|
HTTPClientConfig.Builder |
withHttpClient(org.apache.http.client.HttpClient client)
You can supply a preconfigured HttpClient that you want the
RawClient to delegate to. |
HTTPClientConfig.Builder |
withMapreducePath(String path)
The location of Riak's map reduce resource
|
HTTPClientConfig.Builder |
withMaxConnctions(int maxConnections)
Deprecated.
As of 1.0.8, replaced by
withMaxConnections(int) |
HTTPClientConfig.Builder |
withMaxConnections(int maxConnections)
Maximum number of connections this client may have open at any time.
|
HTTPClientConfig.Builder |
withPort(int port)
Set the port.
|
HTTPClientConfig.Builder |
withRetryHandler(org.apache.http.client.HttpRequestRetryHandler retryHandler)
Apache HttpClient treats some HTTP methods as retry-able, and
provides a default implementation of
HttpRequestRetryHandler
to be called when a request fails. |
HTTPClientConfig.Builder |
withRiakPath(String path)
Set the path to the base Riak REST resource.
|
HTTPClientConfig.Builder |
withScheme(String scheme)
Set the scheme.
|
HTTPClientConfig.Builder |
withTimeout(int timeout)
The connection, socket read and pooled connection acquisition timeout
in milliseconds
|
HTTPClientConfig.Builder |
withUrl(String url)
The URL Riak REST interface.
|
public HTTPClientConfig build()
HTTPClientConfig
public static HTTPClientConfig.Builder from(HTTPClientConfig copyConfig)
copyConfig
copyConfig
- the HTTPClientConfig
to copy values fromHTTPClientConfig.Builder
populated with copyConfig
's values.public HTTPClientConfig.Builder withUrl(String url)
NOTE: Setting this take precedence over setting scheme
,
host
, port
and path
url
- the Riak REST URLpublic HTTPClientConfig.Builder withScheme(String scheme)
NOTE: setting the url
takes precedence.
scheme
- HTTP or HTTPSpublic HTTPClientConfig.Builder withHost(String host)
NOTE: setting the url
takes precedence.
host
- public HTTPClientConfig.Builder withPort(int port)
NOTE: setting the url
takes precedence.
port
- public HTTPClientConfig.Builder withRiakPath(String path)
NOTE: setting the url
takes precedence.
path
- e.g. /riakpublic HTTPClientConfig.Builder withMapreducePath(String path)
path
- e.g. /mapreducepublic HTTPClientConfig.Builder withHttpClient(org.apache.http.client.HttpClient client)
RawClient
to delegate to.client
- a implementation of HttpClient
public HTTPClientConfig.Builder withTimeout(int timeout)
timeout
- in milliseconds@Deprecated public HTTPClientConfig.Builder withMaxConnctions(int maxConnections)
withMaxConnections(int)
withMaxConnections(int)
public HTTPClientConfig.Builder withMaxConnections(int maxConnections)
maxConnections
- The maximum of connections open in this client.public HTTPClientConfig.Builder withRetryHandler(org.apache.http.client.HttpRequestRetryHandler retryHandler)
HttpRequestRetryHandler
to be called when a request fails. Provide an implementation here to
override the default behaviour.retryHandler
- an HttpRequestRetryHandler
implementationCopyright © 2013. All Rights Reserved.