diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java b/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java index f1bd6343a..a5435a393 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java @@ -102,204 +102,98 @@ protected RequestConfig() { } /** - * 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: {@code false} - *
+ * @see Builder#setExpectContinueEnabled(boolean) */ public boolean isExpectContinueEnabled() { return expectContinueEnabled; } /** - * Returns HTTP proxy to be used for request execution. - *- * Default: {@code null} - *
+ * @see Builder#setProxy(HttpHost) */ public HttpHost getProxy() { return proxy; } /** - * Determines the name of the cookie specification to be used for HTTP state - * management. - *- * Default: {@code null} - *
+ * @see Builder#setCookieSpec(String) */ public String getCookieSpec() { return cookieSpec; } /** - * Determines whether redirects should be handled automatically. - *- * Default: {@code true} - *
+ * @see Builder#setRedirectsEnabled(boolean) */ public boolean isRedirectsEnabled() { return redirectsEnabled; } /** - * 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: {@code false} - *
+ * @see Builder#setCircularRedirectsAllowed(boolean) */ public boolean isCircularRedirectsAllowed() { return circularRedirectsAllowed; } /** - * Returns the maximum number of redirects to be followed. The limit on number - * of redirects is intended to prevent infinite loops. - *- * Default: {@code 50} - *
+ * @see Builder#setMaxRedirects(int) */ public int getMaxRedirects() { return maxRedirects; } /** - * Determines whether authentication should be handled automatically. - *- * Default: {@code true} - *
+ * @see Builder#setAuthenticationEnabled(boolean) */ public boolean isAuthenticationEnabled() { return authenticationEnabled; } /** - * Determines the order of preference for supported authentication schemes - * when authenticating with the target host. - *- * Default: {@code null} - *
+ * @see Builder#setTargetPreferredAuthSchemes(Collection) */ public Collection- * Default: {@code null} - *
+ * @see Builder#setProxyPreferredAuthSchemes(Collection) */ public Collection- * A timeout value of zero is interpreted as an infinite timeout. - *
- *- * Default: 3 minutes. - *
+ * @see Builder#setConnectionRequestTimeout(Timeout) */ public Timeout getConnectionRequestTimeout() { return connectionRequestTimeout; } /** - * Determines the timeout until a new connection is fully established. - * This may also include transport security negotiation exchanges - * such as {@code SSL} or {@code TLS} protocol negotiation). - *- * A timeout value of zero is interpreted as an infinite timeout. - *
- *- * Default: 3 minutes - *
+ * @see Builder#setConnectTimeout(Timeout) */ public Timeout getConnectTimeout() { return connectTimeout; } /** - * 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: {@code null} - *
- * - * @since 5.0 + * @see Builder#setResponseTimeout(Timeout) */ public Timeout getResponseTimeout() { return responseTimeout; } /** - * Determines whether the target server is requested to compress content. - *- * Default: {@code true} - *
- * - * @since 4.5 + * @see Builder#setContentCompressionEnabled(boolean) */ public boolean isContentCompressionEnabled() { return contentCompressionEnabled; } /** - * Determines whether request cancellation, such as through {@code - * 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 {@code 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 {@code RST_STREAM}. This - * has no effect on connection reuse. - *
- *- * On non-asynchronous clients, this option has no effect. Request - * cancellation, such as through {@code HttpUriRequestBase#cancel()}, will - * always kill the underlying connection. - *
- *- * Default: {@code true} - *
- * - * @since 5.0 + * @see Builder#setHardCancellationEnabled(boolean) */ public boolean isHardCancellationEnabled() { return hardCancellationEnabled; @@ -381,7 +275,26 @@ public static class Builder { } /** - * @see #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: {@code false} + *
*/ public Builder setExpectContinueEnabled(final boolean expectContinueEnabled) { this.expectContinueEnabled = expectContinueEnabled; @@ -389,7 +302,10 @@ public Builder setExpectContinueEnabled(final boolean expectContinueEnabled) { } /** - * @see #getProxy() + * Returns HTTP proxy to be used for request execution. + *+ * Default: {@code null} + *
*/ public Builder setProxy(final HttpHost proxy) { this.proxy = proxy; @@ -397,7 +313,11 @@ public Builder setProxy(final HttpHost proxy) { } /** - * @see #getCookieSpec() + * Determines the name of the cookie specification to be used for HTTP state + * management. + *+ * Default: {@code null} + *
*/ public Builder setCookieSpec(final String cookieSpec) { this.cookieSpec = cookieSpec; @@ -405,7 +325,10 @@ public Builder setCookieSpec(final String cookieSpec) { } /** - * @see #isRedirectsEnabled() + * Determines whether redirects should be handled automatically. + *+ * Default: {@code true} + *
*/ public Builder setRedirectsEnabled(final boolean redirectsEnabled) { this.redirectsEnabled = redirectsEnabled; @@ -413,7 +336,12 @@ public Builder setRedirectsEnabled(final boolean redirectsEnabled) { } /** - * @see #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: {@code false} + *
*/ public Builder setCircularRedirectsAllowed(final boolean circularRedirectsAllowed) { this.circularRedirectsAllowed = circularRedirectsAllowed; @@ -421,7 +349,11 @@ public Builder setCircularRedirectsAllowed(final boolean circularRedirectsAllowe } /** - * @see #getMaxRedirects() + * Returns the maximum number of redirects to be followed. The limit on number + * of redirects is intended to prevent infinite loops. + *+ * Default: {@code 50} + *
*/ public Builder setMaxRedirects(final int maxRedirects) { this.maxRedirects = maxRedirects; @@ -429,7 +361,10 @@ public Builder setMaxRedirects(final int maxRedirects) { } /** - * @see #isAuthenticationEnabled() + * Determines whether authentication should be handled automatically. + *+ * Default: {@code true} + *
*/ public Builder setAuthenticationEnabled(final boolean authenticationEnabled) { this.authenticationEnabled = authenticationEnabled; @@ -437,7 +372,11 @@ public Builder setAuthenticationEnabled(final boolean authenticationEnabled) { } /** - * @see #getTargetPreferredAuthSchemes() + * Determines the order of preference for supported authentication schemes + * when authenticating with the target host. + *+ * Default: {@code null} + *
*/ public Builder setTargetPreferredAuthSchemes(final Collection+ * Default: {@code null} + *
*/ public Builder setProxyPreferredAuthSchemes(final Collection+ * A timeout value of zero is interpreted as an infinite timeout. + *
+ *+ * Default: 3 minutes. + *
*/ public Builder setConnectionRequestTimeout(final Timeout connectionRequestTimeout) { this.connectionRequestTimeout = connectionRequestTimeout; @@ -461,7 +410,7 @@ public Builder setConnectionRequestTimeout(final Timeout connectionRequestTimeou } /** - * @see #getConnectionRequestTimeout() + * @see #setConnectionRequestTimeout(Timeout) */ public Builder setConnectionRequestTimeout(final long connectionRequestTimeout, final TimeUnit timeUnit) { this.connectionRequestTimeout = Timeout.of(connectionRequestTimeout, timeUnit); @@ -469,7 +418,15 @@ public Builder setConnectionRequestTimeout(final long connectionRequestTimeout, } /** - * @see #getConnectTimeout() + * Determines the timeout until a new connection is fully established. + * This may also include transport security negotiation exchanges + * such as {@code SSL} or {@code TLS} protocol negotiation). + *+ * A timeout value of zero is interpreted as an infinite timeout. + *
+ *+ * Default: 3 minutes + *
*/ public Builder setConnectTimeout(final Timeout connectTimeout) { this.connectTimeout = connectTimeout; @@ -477,7 +434,7 @@ public Builder setConnectTimeout(final Timeout connectTimeout) { } /** - * @see #getConnectTimeout() + * @see #setConnectTimeout(Timeout) */ public Builder setConnectTimeout(final long connectTimeout, final TimeUnit timeUnit) { this.connectTimeout = Timeout.of(connectTimeout, timeUnit); @@ -485,7 +442,20 @@ public Builder setConnectTimeout(final long connectTimeout, final TimeUnit timeU } /** - * @see #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: {@code null} + *
+ * + * @since 5.0 */ public Builder setResponseTimeout(final Timeout responseTimeout) { this.responseTimeout = responseTimeout; @@ -493,7 +463,7 @@ public Builder setResponseTimeout(final Timeout responseTimeout) { } /** - * @see #getResponseTimeout() + * @see #setResponseTimeout(Timeout) */ public Builder setResponseTimeout(final long responseTimeout, final TimeUnit timeUnit) { this.responseTimeout = Timeout.of(responseTimeout, timeUnit); @@ -501,7 +471,12 @@ public Builder setResponseTimeout(final long responseTimeout, final TimeUnit tim } /** - * @see #isContentCompressionEnabled() + * Determines whether the target server is requested to compress content. + *+ * Default: {@code true} + *
+ * + * @since 4.5 */ public Builder setContentCompressionEnabled(final boolean contentCompressionEnabled) { this.contentCompressionEnabled = contentCompressionEnabled; @@ -509,7 +484,31 @@ public Builder setContentCompressionEnabled(final boolean contentCompressionEnab } /** - * @see #isHardCancellationEnabled() + * Determines whether request cancellation, such as through {@code + * 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 {@code 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 {@code RST_STREAM}. This + * has no effect on connection reuse. + *
+ *+ * On non-asynchronous clients, this option has no effect. Request + * cancellation, such as through {@code HttpUriRequestBase#cancel()}, will + * always kill the underlying connection. + *
+ *+ * Default: {@code true} + *
+ * + * @since 5.0 */ public Builder setHardCancellationEnabled(final boolean hardCancellationEnabled) { this.hardCancellationEnabled = hardCancellationEnabled;