org.apache.http.client.config
Class RequestConfig

java.lang.Object
  extended by org.apache.http.client.config.RequestConfig
All Implemented Interfaces:
java.lang.Cloneable

public class RequestConfig
extends java.lang.Object
implements java.lang.Cloneable


Nested Class Summary
static class RequestConfig.Builder
           
 
Field Summary
static RequestConfig DEFAULT
           
 
Method Summary
protected  RequestConfig clone()
           
static RequestConfig.Builder copy(RequestConfig config)
           
static RequestConfig.Builder custom()
           
 int getConnectionRequestTimeout()
          Returns the timeout in milliseconds used when requesting a connection from the connection manager.
 int getConnectTimeout()
          Determines the timeout in milliseconds until a connection is established.
 java.lang.String getCookieSpec()
          Determines the name of the cookie specification to be used for HTTP state management.
 java.net.InetAddress getLocalAddress()
          Returns local address to be used for request execution.
 int getMaxRedirects()
          Returns the maximum number of redirects to be followed.
 org.apache.http.HttpHost getProxy()
          Returns HTTP proxy to be used for request execution.
 java.util.Collection<java.lang.String> getProxyPreferredAuthSchemes()
          Determines the order of preference for supported authentication schemes when authenticating with the proxy host.
 int getSocketTimeout()
          Defines the socket timeout (SO_TIMEOUT) in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets).
 java.util.Collection<java.lang.String> getTargetPreferredAuthSchemes()
          Determines the order of preference for supported authentication schemes when authenticating with the target host.
 boolean isAuthenticationEnabled()
          Determines whether authentication should be handled automatically.
 boolean isCircularRedirectsAllowed()
          Determines whether circular redirects (redirects to the same location) should be allowed.
 boolean isExpectContinueEnabled()
          Determines whether the 'Expect: 100-Continue' handshake is enabled for entity enclosing methods.
 boolean isRedirectsEnabled()
          Determines whether redirects should be handled automatically.
 boolean isRelativeRedirectsAllowed()
          Determines whether relative redirects should be rejected.
 boolean isStaleConnectionCheckEnabled()
          Determines whether stale connection check is to be used.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final RequestConfig DEFAULT
Method Detail

isExpectContinueEnabled

public boolean isExpectContinueEnabled()
Determines whether the 'Expect: 100-Continue' handshake is enabled for entity enclosing methods. The purpose of the 'Expect: 100-Continue' handshake is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body.

The use of the 'Expect: 100-continue' handshake can result in a noticeable performance improvement for entity enclosing requests (such as POST and PUT) that require the target server's authentication.

'Expect: 100-continue' handshake should be used with caution, as it may cause problems with HTTP servers and proxies that do not support HTTP/1.1 protocol.

Default: false


getProxy

public org.apache.http.HttpHost getProxy()
Returns HTTP proxy to be used for request execution.

Default: null


getLocalAddress

public java.net.InetAddress getLocalAddress()
Returns local address to be used for request execution.

On machines with multiple network interfaces, this parameter can be used to select the network interface from which the connection originates.

Default: null


isStaleConnectionCheckEnabled

public boolean isStaleConnectionCheckEnabled()
Determines whether stale connection check is to be used. The stale connection check can cause up to 30 millisecond overhead per request and should be used only when appropriate. For performance critical operations this check should be disabled.

Default: true


getCookieSpec

public java.lang.String getCookieSpec()
Determines the name of the cookie specification to be used for HTTP state management.

Default: null


isRedirectsEnabled

public boolean isRedirectsEnabled()
Determines whether redirects should be handled automatically.

Default: true


isRelativeRedirectsAllowed

public boolean isRelativeRedirectsAllowed()
Determines whether relative redirects should be rejected. HTTP specification requires the location value be an absolute URI.

Default: true


isCircularRedirectsAllowed

public boolean isCircularRedirectsAllowed()
Determines whether circular redirects (redirects to the same location) should be allowed. The HTTP spec is not sufficiently clear whether circular redirects are permitted, therefore optionally they can be enabled

Default: false


getMaxRedirects

public int getMaxRedirects()
Returns the maximum number of redirects to be followed. The limit on number of redirects is intended to prevent infinite loops.

Default: 50


isAuthenticationEnabled

public boolean isAuthenticationEnabled()
Determines whether authentication should be handled automatically.

Default: true


getTargetPreferredAuthSchemes

public java.util.Collection<java.lang.String> getTargetPreferredAuthSchemes()
Determines the order of preference for supported authentication schemes when authenticating with the target host.

Default: null


getProxyPreferredAuthSchemes

public java.util.Collection<java.lang.String> getProxyPreferredAuthSchemes()
Determines the order of preference for supported authentication schemes when authenticating with the proxy host.

Default: null


getConnectionRequestTimeout

public int getConnectionRequestTimeout()
Returns the timeout in milliseconds used when requesting a connection from the connection manager. A timeout value of zero is interpreted as an infinite timeout.

A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as undefined (system default).

Default: -1


getConnectTimeout

public int getConnectTimeout()
Determines the timeout in milliseconds until a connection is established. A timeout value of zero is interpreted as an infinite timeout.

A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as undefined (system default).

Default: -1


getSocketTimeout

public int getSocketTimeout()
Defines the socket timeout (SO_TIMEOUT) in milliseconds, which is the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets).

A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as undefined (system default).

Default: -1


clone

protected RequestConfig clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

custom

public static RequestConfig.Builder custom()

copy

public static RequestConfig.Builder copy(RequestConfig config)