@Contract(threading=IMMUTABLE)
public class RequestConfig
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
RequestConfig.Builder |
Modifier and Type | Field and Description |
---|---|
private boolean |
authenticationEnabled |
private boolean |
circularRedirectsAllowed |
private int |
connectionRequestTimeout |
private int |
connectTimeout |
private boolean |
contentCompressionEnabled |
private java.lang.String |
cookieSpec |
static RequestConfig |
DEFAULT |
private boolean |
expectContinueEnabled |
private java.net.InetAddress |
localAddress |
private int |
maxRedirects |
private boolean |
normalizeUri |
private org.apache.http.HttpHost |
proxy |
private java.util.Collection<java.lang.String> |
proxyPreferredAuthSchemes |
private boolean |
redirectsEnabled |
private boolean |
relativeRedirectsAllowed |
private int |
socketTimeout |
private boolean |
staleConnectionCheckEnabled |
private java.util.Collection<java.lang.String> |
targetPreferredAuthSchemes |
Modifier | Constructor and Description |
---|---|
protected |
RequestConfig()
Intended for CDI compatibility
|
(package private) |
RequestConfig(boolean expectContinueEnabled,
org.apache.http.HttpHost proxy,
java.net.InetAddress localAddress,
boolean staleConnectionCheckEnabled,
java.lang.String cookieSpec,
boolean redirectsEnabled,
boolean relativeRedirectsAllowed,
boolean circularRedirectsAllowed,
int maxRedirects,
boolean authenticationEnabled,
java.util.Collection<java.lang.String> targetPreferredAuthSchemes,
java.util.Collection<java.lang.String> proxyPreferredAuthSchemes,
int connectionRequestTimeout,
int connectTimeout,
int socketTimeout,
boolean contentCompressionEnabled,
boolean normalizeUri) |
Modifier and Type | Method and Description |
---|---|
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 |
isContentCompressionEnabled()
Determines whether the target server is requested to compress content.
|
boolean |
isDecompressionEnabled()
Deprecated.
(4.5) Use
isContentCompressionEnabled() |
boolean |
isExpectContinueEnabled()
Determines whether the 'Expect: 100-Continue' handshake is enabled
for entity enclosing methods.
|
boolean |
isNormalizeUri()
Determines whether client should normalize URIs in requests or not.
|
boolean |
isRedirectsEnabled()
Determines whether redirects should be handled automatically.
|
boolean |
isRelativeRedirectsAllowed()
Determines whether relative redirects should be rejected.
|
boolean |
isStaleConnectionCheckEnabled()
Deprecated.
|
java.lang.String |
toString() |
public static final RequestConfig DEFAULT
private final boolean expectContinueEnabled
private final org.apache.http.HttpHost proxy
private final java.net.InetAddress localAddress
private final boolean staleConnectionCheckEnabled
private final java.lang.String cookieSpec
private final boolean redirectsEnabled
private final boolean relativeRedirectsAllowed
private final boolean circularRedirectsAllowed
private final int maxRedirects
private final boolean authenticationEnabled
private final java.util.Collection<java.lang.String> targetPreferredAuthSchemes
private final java.util.Collection<java.lang.String> proxyPreferredAuthSchemes
private final int connectionRequestTimeout
private final int connectTimeout
private final int socketTimeout
private final boolean contentCompressionEnabled
private final boolean normalizeUri
protected RequestConfig()
RequestConfig(boolean expectContinueEnabled, org.apache.http.HttpHost proxy, java.net.InetAddress localAddress, boolean staleConnectionCheckEnabled, java.lang.String cookieSpec, boolean redirectsEnabled, boolean relativeRedirectsAllowed, boolean circularRedirectsAllowed, int maxRedirects, boolean authenticationEnabled, java.util.Collection<java.lang.String> targetPreferredAuthSchemes, java.util.Collection<java.lang.String> proxyPreferredAuthSchemes, int connectionRequestTimeout, int connectTimeout, int socketTimeout, boolean contentCompressionEnabled, boolean normalizeUri)
public boolean isExpectContinueEnabled()
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
public org.apache.http.HttpHost getProxy()
Default: null
public java.net.InetAddress getLocalAddress()
On machines with multiple network interfaces, this parameter can be used to select the network interface from which the connection originates.
Default: null
@Deprecated public boolean isStaleConnectionCheckEnabled()
PoolingHttpClientConnectionManager.getValidateAfterInactivity()
Default: false
since 4.4
public java.lang.String getCookieSpec()
Default: null
public boolean isRedirectsEnabled()
Default: true
public boolean isRelativeRedirectsAllowed()
Default: true
public boolean isCircularRedirectsAllowed()
Default: false
public int getMaxRedirects()
Default: 50
public boolean isAuthenticationEnabled()
Default: true
public java.util.Collection<java.lang.String> getTargetPreferredAuthSchemes()
Default: null
public java.util.Collection<java.lang.String> getProxyPreferredAuthSchemes()
Default: null
public int getConnectionRequestTimeout()
A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as undefined (system default if applicable).
Default: -1
public int getConnectTimeout()
A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as undefined (system default if applicable).
Default: -1
public int getSocketTimeout()
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 if applicable).
Default: -1
@Deprecated public boolean isDecompressionEnabled()
isContentCompressionEnabled()
Default: true
public boolean isContentCompressionEnabled()
Default: true
public boolean isNormalizeUri()
Default: true
protected RequestConfig clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.lang.Object
public static RequestConfig.Builder custom()
public static RequestConfig.Builder copy(RequestConfig config)