com.basho.riak.client.raw.http
Class HTTPClientConfig.Builder

java.lang.Object
  extended by com.basho.riak.client.raw.http.HTTPClientConfig.Builder
Enclosing class:
HTTPClientConfig

public static final class HTTPClientConfig.Builder
extends Object

Use the builder to create a new instance of 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 Summary
HTTPClientConfig.Builder()
           
 
Method Summary
 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)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPClientConfig.Builder

public HTTPClientConfig.Builder()
Method Detail

build

public HTTPClientConfig build()
Returns:
a HTTPClientConfig

from

public static HTTPClientConfig.Builder from(HTTPClientConfig copyConfig)
Create a new builder with values all copied from copyConfig

Parameters:
copyConfig - the HTTPClientConfig to copy values from
Returns:
a new HTTPClientConfig.Builder populated with copyConfig 's values.

withUrl

public HTTPClientConfig.Builder withUrl(String url)
The URL Riak REST interface.

NOTE: Setting this take precedence over setting scheme, host, port and path

Parameters:
url - the Riak REST URL
Returns:
this

withScheme

public HTTPClientConfig.Builder withScheme(String scheme)
Set the scheme.

NOTE: setting the url takes precedence.

Parameters:
scheme - HTTP or HTTPS
Returns:
this

withHost

public HTTPClientConfig.Builder withHost(String host)
Set the host.

NOTE: setting the url takes precedence.

Parameters:
host -
Returns:
this

withPort

public HTTPClientConfig.Builder withPort(int port)
Set the port.

NOTE: setting the url takes precedence.

Parameters:
port -
Returns:
this

withRiakPath

public HTTPClientConfig.Builder withRiakPath(String path)
Set the path to the base Riak REST resource.

NOTE: setting the url takes precedence.

Parameters:
path - e.g. /riak
Returns:
this

withMapreducePath

public HTTPClientConfig.Builder withMapreducePath(String path)
The location of Riak's map reduce resource

Parameters:
path - e.g. /mapreduce
Returns:
this

withHttpClient

public HTTPClientConfig.Builder withHttpClient(org.apache.http.client.HttpClient client)
You can supply a preconfigured HttpClient that you want the RawClient to delegate to.

Parameters:
client - a implementation of HttpClient
Returns:
this

withTimeout

public HTTPClientConfig.Builder withTimeout(int timeout)
The connection, socket read and pooled connection acquisition timeout in milliseconds

Parameters:
timeout - in milliseconds
Returns:
this

withMaxConnctions

public HTTPClientConfig.Builder withMaxConnctions(int maxConnections)
Maximum number of connections this client may have open at any time.

Parameters:
maxConnections -
Returns:
this

withRetryHandler

public 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. Provide an implementation here to override the default behaviour.

Parameters:
retryHandler - an HttpRequestRetryHandler implementation
Returns:
this


Copyright © 2012. All Rights Reserved.