org.apache.hc.client5.http.config

## Class RequestConfig

- java.lang.Object
- - org.apache.hc.client5.http.config.RequestConfig

All Implemented Interfaces:
  Cloneable

    @Contract(threading=IMMUTABLE)
    public class RequestConfig
    extends Object
    implements Cloneable

Immutable class encapsulating request configuration items.

### Nested Class Summary

Nested Classes
`static class` `RequestConfig.Builder`

### Field Summary

Fields
`static RequestConfig` `DEFAULT`

### Constructor Summary

Constructors
`protected` `RequestConfig()` Intended for CDI compatibility

### Method Summary

Methods
`protected RequestConfig` `clone()`
`static RequestConfig.Builder` `copy(RequestConfig config)`
`static RequestConfig.Builder` `custom()`
`Timeout` `getConnectionRequestTimeout()` Returns the connection lease request timeout used when requesting a connection from the connection manager.
`Timeout` `getConnectTimeout()` Determines the timeout until a new connection is fully established.
`String` `getCookieSpec()` Determines the name of the cookie specification to be used for HTTP state management.
`int` `getMaxRedirects()` Returns the maximum number of redirects to be followed.
`HttpHost` `getProxy()` Returns HTTP proxy to be used for request execution.
`Collection<String>` `getProxyPreferredAuthSchemes()` Determines the order of preference for supported authentication schemes when authenticating with the proxy host.
`Timeout` `getResponseTimeout()` Determines the timeout until arrival of a response from the opposite endpoint.
`Collection<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` `isExpectContinueEnabled()` Determines whether the 'Expect: 100-Continue' handshake is enabled for entity enclosing methods.
`boolean` `isHardCancellationEnabled()` Determines whether request cancellation, such as through `Future#cancel(boolean)`, should kill the underlying connection.
`boolean` `isRedirectsEnabled()` Determines whether redirects should be handled automatically.
`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

### Constructor Detail

#### RequestConfig

    protected RequestConfig()

Intended for CDI compatibility

### 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 HttpHost getProxy()

Returns HTTP proxy to be used for request execution.

Default: `null`

#### getCookieSpec

    public 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`

#### 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 Collection<String> getTargetPreferredAuthSchemes()

Determines the order of preference for supported authentication schemes when authenticating with the target host.

Default: `null`

#### getProxyPreferredAuthSchemes

    public Collection<String> getProxyPreferredAuthSchemes()

Determines the order of preference for supported authentication schemes when authenticating with the proxy host.

Default: `null`

#### getConnectionRequestTimeout

    public Timeout getConnectionRequestTimeout()

Returns the connection lease request timeout used when requesting a connection from the connection manager.

A timeout value of zero is interpreted as an infinite timeout.

Default: 3 minutes.

#### getConnectTimeout

    public Timeout getConnectTimeout()

Determines the timeout until a new connection is fully established. This may also include transport security negotiation exchanges such as `SSL` or `TLS` protocol negotiation).

A timeout value of zero is interpreted as an infinite timeout.

Default: 3 minutes

#### getResponseTimeout

    public Timeout getResponseTimeout()

Determines the timeout until arrival of a response from the opposite endpoint.

A timeout value of zero is interpreted as an infinite timeout.

Please note that response timeout may be unsupported by HTTP transports with message multiplexing.

Default: `null`

Since:
  5.0

#### isContentCompressionEnabled

    public boolean isContentCompressionEnabled()

Determines whether the target server is requested to compress content.

Default: `true`

Since:
  4.5

#### isHardCancellationEnabled

    public boolean isHardCancellationEnabled()

Determines whether request cancellation, such as through `Future#cancel(boolean)`, should kill the underlying connection. If this option is set to false, the client will attempt to preserve the underlying connection by allowing the request to complete in the background, discarding the response.

Note that when this option is `true`, cancelling a request may cause other requests to fail, if they are waiting to use the same connection.

On HTTP/2, this option has no effect. Request cancellation will always result in the stream being cancelled with a `RST_STREAM`. This has no effect on connection reuse.

On non-asynchronous clients, this option has no effect. Request cancellation, such as through `HttpUriRequestBase#cancel()`, will always kill the underlying connection.

Default: `true`

Since:
  5.0

#### clone

    protected RequestConfig clone()
                           throws CloneNotSupportedException

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### custom

    public static RequestConfig.Builder custom()

#### copy

    public static RequestConfig.Builder copy(RequestConfig config)