com.jayway.restassured.config
Class HttpClientConfig

java.lang.Object
  extended by com.jayway.restassured.config.HttpClientConfig

public class HttpClientConfig
extends Object

Configure the Apache HTTP Client parameters.

Note that you can't configure the redirect settings from this config. Please use RedirectConfig for this purpose.

See Also:
org.apache.http.client.params.ClientPNames, org.apache.http.params.CoreProtocolPNames

Constructor Summary
HttpClientConfig()
          Creates a new HttpClientConfig instance with no parameters set
HttpClientConfig(Map<String,?> httpClientParams)
          Creates a new HttpClientConfig instance with the parameters defined by the httpClientParams.
 
Method Summary
 HttpClientConfig addParams(Map<String,?> httpClientParams)
          Add the given parameters to an already configured number of parameters.
 HttpClientConfig and()
           
static HttpClientConfig httpClientConfig()
           
 Map<String,?> params()
           
<T> HttpClientConfig
setParam(String parameterName, T parameterValue)
          Set a http client parameter.
 HttpClientConfig setParams(Map<String,?> httpClientParams)
          Replaces the currently configured parameters with the ones supplied by httpClientParams.
 HttpClientConfig withParams(Map<String,?> httpClientParams)
          Replaces the currently configured parameters with the ones supplied by httpClientParams.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientConfig

public HttpClientConfig()
Creates a new HttpClientConfig instance with no parameters set


HttpClientConfig

public HttpClientConfig(Map<String,?> httpClientParams)
Creates a new HttpClientConfig instance with the parameters defined by the httpClientParams.

Method Detail

params

public Map<String,?> params()
Returns:
The configured parameters

and

public HttpClientConfig and()
Returns:
The same HttpClientConfig instance. Only here for syntactic sugar.

setParam

public <T> HttpClientConfig setParam(String parameterName,
                                     T parameterValue)
Set a http client parameter.

Type Parameters:
T - The parameter type
Parameters:
parameterName - The name of the parameter
parameterValue - The value of the parameter (may be null)
Returns:
An updated HttpClientConfig

withParams

public HttpClientConfig withParams(Map<String,?> httpClientParams)
Replaces the currently configured parameters with the ones supplied by httpClientParams. This method is the same as setParams(java.util.Map).

Parameters:
httpClientParams - The parameters to set.
Returns:
An updated HttpClientConfig

setParams

public HttpClientConfig setParams(Map<String,?> httpClientParams)
Replaces the currently configured parameters with the ones supplied by httpClientParams. This method is the same as withParams(java.util.Map).

Parameters:
httpClientParams - The parameters to set.
Returns:
An updated HttpClientConfig

addParams

public HttpClientConfig addParams(Map<String,?> httpClientParams)
Add the given parameters to an already configured number of parameters.

Parameters:
httpClientParams - The parameters.
Returns:
An updated HttpClientConfig

httpClientConfig

public static HttpClientConfig httpClientConfig()
Returns:
A static way to create a new HttpClientConfig instance without calling "new" explicitly. Mainly for syntactic sugar.


Copyright © 2010-2011. All Rights Reserved.