org.ektorp.http
Class StdHttpClient.Builder

java.lang.Object
  extended by org.ektorp.http.StdHttpClient.Builder
Enclosing class:
StdHttpClient

public static class StdHttpClient.Builder
extends Object


Constructor Summary
StdHttpClient.Builder()
           
 
Method Summary
 HttpClient build()
           
 StdHttpClient.Builder caching(boolean b)
          Controls if the http client should cache response entities.
 StdHttpClient.Builder cleanupIdleConnections(boolean b)
          If set to true, a monitor thread will be started that cleans up idle connections every 30 seconds.
 org.apache.http.client.HttpClient configureClient()
           
 org.apache.http.conn.ClientConnectionManager configureConnectionManager(org.apache.http.params.HttpParams params)
           
 StdHttpClient.Builder connectionManager(org.apache.http.conn.ClientConnectionManager cm)
          Bring your own Connection Manager.
 StdHttpClient.Builder connectionTimeout(int i)
           
 StdHttpClient.Builder enableSSL(boolean b)
          Set to true in order to enable SSL sockets.
 StdHttpClient.Builder host(String s)
           
 StdHttpClient.Builder maxCacheEntries(int m)
           
 StdHttpClient.Builder maxConnections(int i)
           
 StdHttpClient.Builder maxObjectSizeBytes(int m)
           
 StdHttpClient.Builder password(String s)
           
 StdHttpClient.Builder port(int i)
           
 StdHttpClient.Builder proxy(String s)
           
 StdHttpClient.Builder proxyPort(int p)
           
 StdHttpClient.Builder relaxedSSLSettings(boolean b)
          If set to true all SSL certificates and hosts will be trusted.
 StdHttpClient.Builder socketTimeout(int i)
           
 StdHttpClient.Builder sslSocketFactory(org.apache.http.conn.ssl.SSLSocketFactory f)
          Bring your own SSLSocketFactory.
 StdHttpClient.Builder url(String s)
           
 StdHttpClient.Builder url(URL url)
          Will set host, port and possible enables SSL based on the properties if the supplied URL.
 StdHttpClient.Builder useExpectContinue(boolean b)
          Activates 'Expect: 100-Continue' handshake with CouchDB.
 StdHttpClient.Builder username(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StdHttpClient.Builder

public StdHttpClient.Builder()
Method Detail

url

public StdHttpClient.Builder url(String s)
                          throws MalformedURLException
Throws:
MalformedURLException

url

public StdHttpClient.Builder url(URL url)
Will set host, port and possible enables SSL based on the properties if the supplied URL. This method overrides the properties: host, port and enableSSL.

Parameters:
url -
Returns:

host

public StdHttpClient.Builder host(String s)

proxyPort

public StdHttpClient.Builder proxyPort(int p)

proxy

public StdHttpClient.Builder proxy(String s)

caching

public StdHttpClient.Builder caching(boolean b)
Controls if the http client should cache response entities. Default is true.

Parameters:
b -
Returns:

maxCacheEntries

public StdHttpClient.Builder maxCacheEntries(int m)

maxObjectSizeBytes

public StdHttpClient.Builder maxObjectSizeBytes(int m)

configureConnectionManager

public org.apache.http.conn.ClientConnectionManager configureConnectionManager(org.apache.http.params.HttpParams params)

configureClient

public org.apache.http.client.HttpClient configureClient()

port

public StdHttpClient.Builder port(int i)

username

public StdHttpClient.Builder username(String s)

password

public StdHttpClient.Builder password(String s)

maxConnections

public StdHttpClient.Builder maxConnections(int i)

connectionTimeout

public StdHttpClient.Builder connectionTimeout(int i)

socketTimeout

public StdHttpClient.Builder socketTimeout(int i)

cleanupIdleConnections

public StdHttpClient.Builder cleanupIdleConnections(boolean b)
If set to true, a monitor thread will be started that cleans up idle connections every 30 seconds.

Parameters:
b -
Returns:

connectionManager

public StdHttpClient.Builder connectionManager(org.apache.http.conn.ClientConnectionManager cm)
Bring your own Connection Manager. If this parameters is set, the parameters port, maxConnections, connectionTimeout and socketTimeout are ignored.

Parameters:
cm -
Returns:

enableSSL

public StdHttpClient.Builder enableSSL(boolean b)
Set to true in order to enable SSL sockets. Note that the CouchDB host must be accessible through a https:// path Default is false.

Parameters:
s -
Returns:

sslSocketFactory

public StdHttpClient.Builder sslSocketFactory(org.apache.http.conn.ssl.SSLSocketFactory f)
Bring your own SSLSocketFactory. Note that schemeName must be also be configured to "https". Will override any setting of relaxedSSLSettings.

Parameters:
f -
Returns:

relaxedSSLSettings

public StdHttpClient.Builder relaxedSSLSettings(boolean b)
If set to true all SSL certificates and hosts will be trusted. This might be handy during development. default is false.

Parameters:
b -
Returns:

useExpectContinue

public StdHttpClient.Builder useExpectContinue(boolean b)
Activates 'Expect: 100-Continue' handshake with CouchDB. Using expect continue can reduce stale connection problems for PUT / POST operations. body. Enabled by default.

Parameters:
b -
Returns:

build

public HttpClient build()


Copyright © 2011. All Rights Reserved.