Javadoc improvements

- No need to use a FQCN when the name is already importted
- Import type instead of using a FQCN
- Use camel-case in paramerter name
- Add missing Javadoc
- Add some missing return tags
- Close some HTML tags
- Fix some comments
- Update Javadoc links
This commit is contained in:
Gary Gregory 2024-08-17 11:20:08 -04:00
parent d05f4c5c8c
commit 75aabd7f62
24 changed files with 456 additions and 38 deletions

View File

@ -28,6 +28,7 @@ package org.apache.hc.client5.http.impl.cache;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
@ -41,7 +42,7 @@ import org.apache.hc.core5.util.Args;
/**
* Basic {@link HttpCacheStorage} implementation backed by an instance of
* {@link java.util.LinkedHashMap}. In other words, cache entries and
* {@link LinkedHashMap}. In other words, cache entries and
* the cached response bodies are held in-memory. This cache does NOT
* deallocate resources associated with the cache entries; it is intended
* for use with {@link HeapResource} and similar. This is the default cache

View File

@ -357,6 +357,7 @@ public class CacheConfig implements Cloneable {
/**
* Specifies the maximum response body size that will be eligible for caching.
* @param maxObjectSize size in bytes
* @return this instance.
*/
public Builder setMaxObjectSize(final long maxObjectSize) {
this.maxObjectSize = maxObjectSize;
@ -365,6 +366,8 @@ public class CacheConfig implements Cloneable {
/**
* Sets the maximum number of cache entries the cache will retain.
*
* @return this instance.
*/
public Builder setMaxCacheEntries(final int maxCacheEntries) {
this.maxCacheEntries = maxCacheEntries;
@ -373,6 +376,8 @@ public class CacheConfig implements Cloneable {
/**
* Sets the number of times to retry a cache processChallenge on failure
*
* @return this instance.
*/
public Builder setMaxUpdateRetries(final int maxUpdateRetries) {
this.maxUpdateRetries = maxUpdateRetries;
@ -380,6 +385,7 @@ public class CacheConfig implements Cloneable {
}
/**
* @return this instance.
* @deprecated Has no effect. Do not use.
*/
@Deprecated
@ -388,6 +394,7 @@ public class CacheConfig implements Cloneable {
}
/**
* @return this instance.
* @deprecated No longer applicable. Do not use.
*/
@Deprecated
@ -399,6 +406,7 @@ public class CacheConfig implements Cloneable {
* Enables or disables heuristic caching.
* @param heuristicCachingEnabled should be {@code true} to
* permit heuristic caching, {@code false} to enable it.
* @return this instance.
*/
public Builder setHeuristicCachingEnabled(final boolean heuristicCachingEnabled) {
this.heuristicCachingEnabled = heuristicCachingEnabled;
@ -412,6 +420,7 @@ public class CacheConfig implements Cloneable {
* response will be considered heuristically fresh.
* @param heuristicCoefficient should be between {@code 0.0} and
* {@code 1.0}.
* @return this instance.
*/
public Builder setHeuristicCoefficient(final float heuristicCoefficient) {
this.heuristicCoefficient = heuristicCoefficient;
@ -427,6 +436,7 @@ public class CacheConfig implements Cloneable {
* @param heuristicDefaultLifetime is the number to consider a
* cache-eligible response fresh in the absence of other information.
* Set this to {@code 0} to disable this style of heuristic caching.
* @return this instance.
*/
public Builder setHeuristicDefaultLifetime(final TimeValue heuristicDefaultLifetime) {
this.heuristicDefaultLifetime = heuristicDefaultLifetime;
@ -438,6 +448,8 @@ public class CacheConfig implements Cloneable {
* @param sharedCache true to behave as a shared cache, false to
* behave as a non-shared (private) cache. To have the cache
* behave like a browser cache, you want to set this to {@code false}.
*
* @return this instance.
*/
public Builder setSharedCache(final boolean sharedCache) {
this.sharedCache = sharedCache;
@ -449,6 +461,7 @@ public class CacheConfig implements Cloneable {
* revalidations due to the {@code stale-while-revalidate} directive.
* @param asynchronousWorkers number of threads; a value of 0 disables background
* revalidations.
* @return this instance.
*/
public Builder setAsynchronousWorkers(final int asynchronousWorkers) {
this.asynchronousWorkers = asynchronousWorkers;
@ -461,6 +474,7 @@ public class CacheConfig implements Cloneable {
* string, false to cache if explicit cache headers are found. Set this to {@code true}
* to better emulate IE, which also never caches responses, regardless of what caching
* headers may be present.
* @return this instance.
*/
public Builder setNeverCacheHTTP10ResponsesWithQueryString(
final boolean neverCacheHTTP10ResponsesWithQuery) {
@ -476,10 +490,11 @@ public class CacheConfig implements Cloneable {
* server and improve performance.
* <p>
* By default, the stale-if-error directive is disabled.
* </p>
*
* @param enabled a boolean value indicating whether the stale-if-error
* directive should be enabled.
* @return the builder object
* @return this instance.
*/
public Builder setStaleIfErrorEnabled(final boolean enabled) {
this.staleIfErrorEnabled = enabled;
@ -495,7 +510,7 @@ public class CacheConfig implements Cloneable {
* Sets the flag indicating whether HTTP/1.1 responses with a query string should never be cached.
*
* @param neverCacheHTTP11ResponsesWithQuery whether to never cache HTTP/1.1 responses with a query string
* @return the builder object
* @return this instance.
*/
public Builder setNeverCacheHTTP11ResponsesWithQueryString(
final boolean neverCacheHTTP11ResponsesWithQuery) {

View File

@ -94,6 +94,7 @@ public class Executor {
}
/**
* @return this instance.
* @since 4.5
*/
public Executor use(final CredentialsStore credentialsStore) {
@ -116,6 +117,7 @@ public class Executor {
}
/**
* @return this instance.
* @since 4.4
*/
public Executor auth(final String host, final Credentials credentials) {
@ -142,6 +144,7 @@ public class Executor {
}
/**
* @return this instance.
* @since 4.4
*/
public Executor authPreemptive(final String host) {
@ -168,6 +171,7 @@ public class Executor {
}
/**
* @return this instance.
* @since 4.4
*/
public Executor authPreemptiveProxy(final String proxy) {
@ -186,6 +190,7 @@ public class Executor {
}
/**
* @return this instance.
* @deprecated Use {@link #auth(HttpHost, String, char[])}.
*/
@Deprecated
@ -204,6 +209,7 @@ public class Executor {
}
/**
* @return this instance.
* @since 4.5
*/
public Executor use(final CookieStore cookieStore) {

View File

@ -217,6 +217,7 @@ public class Request {
}
/**
* @return this instance.
* @since 4.3
*/
public Request setHeader(final Header header) {
@ -230,6 +231,7 @@ public class Request {
}
/**
* @return this instance.
* @since 4.3
*/
public Request setHeader(final String name, final String value) {
@ -262,6 +264,7 @@ public class Request {
}
/**
* @return this instance.
* @deprecated Use {@link #setDate(Instant)}
*/
@Deprecated
@ -271,6 +274,7 @@ public class Request {
}
/**
* @return this instance.
* @deprecated Use {@link #setIfModifiedSince(Instant)}
*/
@Deprecated
@ -280,6 +284,7 @@ public class Request {
}
/**
* @return this instance.
* @deprecated Use {@link #setIfUnmodifiedSince(Instant)}
*/
@Deprecated
@ -340,6 +345,7 @@ public class Request {
}
/**
* @return this instance.
* @since 4.4
*/
public Request viaProxy(final String proxy) {
@ -392,6 +398,7 @@ public class Request {
}
/**
* @return this instance.
* @since 4.4
*/
public Request bodyByteArray(final byte[] b, final ContentType contentType) {
@ -403,6 +410,7 @@ public class Request {
}
/**
* @return this instance.
* @since 4.4
*/
public Request bodyByteArray(final byte[] b, final int off, final int len, final ContentType contentType) {

View File

@ -116,7 +116,7 @@ public class NTCredentials implements Credentials, Serializable {
* <p>
* This constructor creates a new instance of NTCredentials, determining the workstation name at runtime
* using the {@link #getWorkstationName()} method. The workstation name will be converted to uppercase
* using the {@link java.util.Locale#ROOT} locale.
* using the {@link Locale#ROOT} locale.
*/
public NTCredentials(
final char[] password,

View File

@ -140,6 +140,7 @@ public class ConnectionConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setSocketTimeout(Timeout)
*/
public Builder setSocketTimeout(final int soTimeout, final TimeUnit timeUnit) {
@ -153,7 +154,7 @@ public class ConnectionConfig implements Cloneable {
* Default: {@code null} (undefined)
* </p>
*
* @return the default socket timeout value for I/O operations.
* @return this instance.
*/
public Builder setSocketTimeout(final Timeout soTimeout) {
this.socketTimeout = soTimeout;
@ -168,6 +169,8 @@ public class ConnectionConfig implements Cloneable {
* <p>
* Default: 3 minutes
* </p>
*
* @return this instance.
*/
public Builder setConnectTimeout(final Timeout connectTimeout) {
this.connectTimeout = connectTimeout;
@ -175,6 +178,7 @@ public class ConnectionConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setConnectTimeout(Timeout)
*/
public Builder setConnectTimeout(final long connectTimeout, final TimeUnit timeUnit) {
@ -189,6 +193,8 @@ public class ConnectionConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setValidateAfterInactivity(final TimeValue validateAfterInactivity) {
this.validateAfterInactivity = validateAfterInactivity;
@ -196,6 +202,7 @@ public class ConnectionConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setValidateAfterInactivity(TimeValue)
*/
public Builder setValidateAfterInactivity(final long validateAfterInactivity, final TimeUnit timeUnit) {
@ -208,6 +215,8 @@ public class ConnectionConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setTimeToLive(final TimeValue timeToLive) {
this.timeToLive = timeToLive;
@ -215,6 +224,7 @@ public class ConnectionConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setTimeToLive(TimeValue)
*/
public Builder setTimeToLive(final long timeToLive, final TimeUnit timeUnit) {

View File

@ -331,6 +331,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code false}
* </p>
*
* @return this instance.
*/
public Builder setExpectContinueEnabled(final boolean expectContinueEnabled) {
this.expectContinueEnabled = expectContinueEnabled;
@ -343,6 +345,7 @@ public class RequestConfig implements Cloneable {
* Default: {@code null}
* </p>
*
* @return this instance.
* @deprecated Use {@link org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner}
* or a custom {@link org.apache.hc.client5.http.routing.HttpRoutePlanner}.
*/
@ -358,6 +361,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code null}
* </p>
*
* @return this instance.
*/
public Builder setCookieSpec(final String cookieSpec) {
this.cookieSpec = cookieSpec;
@ -369,6 +374,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code true}
* </p>
*
* @return this instance.
*/
public Builder setRedirectsEnabled(final boolean redirectsEnabled) {
this.redirectsEnabled = redirectsEnabled;
@ -382,6 +389,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code false}
* </p>
*
* @return this instance.
*/
public Builder setCircularRedirectsAllowed(final boolean circularRedirectsAllowed) {
this.circularRedirectsAllowed = circularRedirectsAllowed;
@ -394,6 +403,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code 50}
* </p>
*
* @return this instance.
*/
public Builder setMaxRedirects(final int maxRedirects) {
this.maxRedirects = maxRedirects;
@ -405,6 +416,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code true}
* </p>
*
* @return this instance.
*/
public Builder setAuthenticationEnabled(final boolean authenticationEnabled) {
this.authenticationEnabled = authenticationEnabled;
@ -417,6 +430,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code null}
* </p>
*
* @return this instance.
*/
public Builder setTargetPreferredAuthSchemes(final Collection<String> targetPreferredAuthSchemes) {
this.targetPreferredAuthSchemes = targetPreferredAuthSchemes;
@ -429,6 +444,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: {@code null}
* </p>
*
* @return this instance.
*/
public Builder setProxyPreferredAuthSchemes(final Collection<String> proxyPreferredAuthSchemes) {
this.proxyPreferredAuthSchemes = proxyPreferredAuthSchemes;
@ -440,6 +457,8 @@ public class RequestConfig implements Cloneable {
* <p>
* Default: 3 minutes.
* </p>
*
* @return this instance.
*/
public Builder setConnectionRequestTimeout(final Timeout connectionRequestTimeout) {
this.connectionRequestTimeout = connectionRequestTimeout;
@ -447,6 +466,7 @@ public class RequestConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setConnectionRequestTimeout(Timeout)
*/
public Builder setConnectionRequestTimeout(final long connectionRequestTimeout, final TimeUnit timeUnit) {
@ -465,6 +485,7 @@ public class RequestConfig implements Cloneable {
* Default: 3 minutes
* </p>
*
* @return this instance.
* @deprecated Use {@link ConnectionConfig.Builder#setConnectTimeout(Timeout)}.
*/
@Deprecated
@ -476,6 +497,7 @@ public class RequestConfig implements Cloneable {
/**
* @see #setConnectTimeout(Timeout)
*
* @return this instance.
* @deprecated Use {@link ConnectionConfig.Builder#setConnectTimeout(long, TimeUnit)}.
*/
@Deprecated
@ -498,6 +520,7 @@ public class RequestConfig implements Cloneable {
* Default: {@code null}
* </p>
*
* @return this instance.
* @since 5.0
*/
public Builder setResponseTimeout(final Timeout responseTimeout) {
@ -524,6 +547,7 @@ public class RequestConfig implements Cloneable {
* Default: 3 minutes
* </p>
*
* @return this instance.
* @since 5.0
*/
public Builder setConnectionKeepAlive(final TimeValue connectionKeepAlive) {
@ -532,6 +556,7 @@ public class RequestConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setConnectionKeepAlive(TimeValue)
*/
public Builder setDefaultKeepAlive(final long defaultKeepAlive, final TimeUnit timeUnit) {
@ -545,6 +570,7 @@ public class RequestConfig implements Cloneable {
* Default: {@code true}
* </p>
*
* @return this instance.
* @since 4.5
*/
public Builder setContentCompressionEnabled(final boolean contentCompressionEnabled) {
@ -577,6 +603,7 @@ public class RequestConfig implements Cloneable {
* Default: {@code true}
* </p>
*
* @return this instance.
* @since 5.0
*/
public Builder setHardCancellationEnabled(final boolean hardCancellationEnabled) {
@ -594,6 +621,7 @@ public class RequestConfig implements Cloneable {
* Default: {@code true}
* </p>
*
* @return this instance.
* @since 5.4
*/
public Builder setProtocolUpgradeEnabled(final boolean protocolUpgradeEnabled) {

View File

@ -142,6 +142,8 @@ public class TlsConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setHandshakeTimeout(final Timeout handshakeTimeout) {
this.handshakeTimeout = handshakeTimeout;
@ -149,6 +151,7 @@ public class TlsConfig implements Cloneable {
}
/**
* @return this instance.
* @see #setHandshakeTimeout(Timeout)
*/
public Builder setHandshakeTimeout(final long handshakeTimeout, final TimeUnit timeUnit) {
@ -161,6 +164,8 @@ public class TlsConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setSupportedProtocols(final String... supportedProtocols) {
this.supportedProtocols = supportedProtocols;
@ -172,6 +177,8 @@ public class TlsConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setSupportedProtocols(final TLS... supportedProtocols) {
this.supportedProtocols = new String[supportedProtocols.length];
@ -189,6 +196,8 @@ public class TlsConfig implements Cloneable {
* <p>
* Default: {@code null} (undefined)
* </p>
*
* @return this instance.
*/
public Builder setSupportedCipherSuites(final String... supportedCipherSuites) {
this.supportedCipherSuites = supportedCipherSuites;
@ -201,6 +210,8 @@ public class TlsConfig implements Cloneable {
* <p>
* Default: {@link HttpVersionPolicy#NEGOTIATE}
* </p>
*
* @return this instance.
*/
public Builder setVersionPolicy(final HttpVersionPolicy versionPolicy) {
this.versionPolicy = versionPolicy;

View File

@ -130,7 +130,7 @@ public class BasicCookieStore implements CookieStore, Serializable {
/**
* Removes all of {@link Cookie cookies} in this HTTP state
* that have expired by the specified {@link java.util.Date date}.
* that have expired by the specified {@link Date date}.
*
* @return true if any cookies were purged.
*

View File

@ -56,7 +56,7 @@ public interface CookieStore {
/**
* Removes all of {@link Cookie}s in this store that have expired by
* the specified {@link java.util.Date}.
* the specified {@link Date}.
*
* @return true if any cookies were purged.
* @deprecated Use {@link #clearExpired(Instant)}

View File

@ -110,7 +110,7 @@ public class EntityBuilder {
* {@link #setFile(java.io.File)} methods.
*
* @param text entity content as a string.
* @return this
* @return this instance.
*/
public EntityBuilder setText(final String text) {
clearContent();
@ -138,7 +138,7 @@ public class EntityBuilder {
* {@link #setFile(java.io.File)}.
*
* @param binary The new entity content as a byte array.
* @return this
* @return this instance.
*/
public EntityBuilder setBinary(final byte[] binary) {
clearContent();
@ -166,7 +166,7 @@ public class EntityBuilder {
* {@link #setFile(java.io.File)}.
*
* @param stream The new entity content as an InputStream.
* @return this
* @return this instance.
*/
public EntityBuilder setStream(final InputStream stream) {
clearContent();
@ -194,7 +194,7 @@ public class EntityBuilder {
* {@link #setFile(java.io.File)}.
*
* @param parameters entity content as a parameter list.
* @return this
* @return this instance.
*/
public EntityBuilder setParameters(final List<NameValuePair> parameters) {
clearContent();
@ -237,7 +237,7 @@ public class EntityBuilder {
* {@link #setFile(java.io.File)}.
*
* @param serializable entity content as a {@link Serializable}.
* @return this
* @return this instance.
*/
public EntityBuilder setSerializable(final Serializable serializable) {
clearContent();
@ -265,7 +265,7 @@ public class EntityBuilder {
* {@link #setSerializable(java.io.Serializable)}.
*
* @param file entity content as a {@link File}.
* @return this
* @return this instance.
*/
public EntityBuilder setFile(final File file) {
clearContent();
@ -286,7 +286,7 @@ public class EntityBuilder {
* Sets the {@link ContentType} of the entity.
*
* @param contentType the {@link ContentType} of the entity, may be null.
* @return this
* @return this instance.
*/
public EntityBuilder setContentType(final ContentType contentType) {
this.contentType = contentType;
@ -306,7 +306,7 @@ public class EntityBuilder {
* Sets the content encoding of the entity.
*
* @param contentEncoding the content encoding of the entity, may be null.
* @return this
* @return this instance.
*/
public EntityBuilder setContentEncoding(final String contentEncoding) {
this.contentEncoding = contentEncoding;
@ -324,7 +324,7 @@ public class EntityBuilder {
/**
* Sets entities to be chunked.
* @return this
* @return this instance.
*/
public EntityBuilder chunked() {
this.chunked = true;
@ -343,7 +343,7 @@ public class EntityBuilder {
/**
* Sets entities to be GZIP compressed.
*
* @return this
* @return this instance.
*/
public EntityBuilder gzipCompressed() {
this.gzipCompressed = true;

View File

@ -30,7 +30,7 @@ import java.io.IOException;
import java.io.InputStream;
/**
* Factory for decorated {@link java.io.InputStream}s.
* Factory for decorated {@link InputStream}s.
*
* @since 4.4
*/

View File

@ -119,6 +119,7 @@ import org.apache.hc.core5.util.Args;
}
/**
* @return this instance.
* @since 4.5
*/
public MultipartEntityBuilder setContentType(final ContentType contentType) {
@ -130,7 +131,7 @@ import org.apache.hc.core5.util.Args;
* Add parameter to the current {@link ContentType}.
*
* @param parameter The name-value pair parameter to add to the {@link ContentType}.
* @return the {@link MultipartEntityBuilder} instance.
* @return this instance.
* @since 5.2
*/
public MultipartEntityBuilder addParameter(final BasicNameValuePair parameter) {
@ -208,7 +209,7 @@ import org.apache.hc.core5.util.Args;
* boundary delimiter. The preamble is optional and may be null.
*
* @param preamble The preamble text to add to the multipart entity
* @return This MultipartEntityBuilder instance, to allow for method chaining
* @return this instance.
*
* @since 5.3
*/
@ -222,7 +223,7 @@ import org.apache.hc.core5.util.Args;
* boundary delimiter. The epilogue is optional and may be null.
*
* @param epilogue The epilogue text to add to the multipart entity
* @return This MultipartEntityBuilder instance, to allow for method chaining
* @return this instance.
* @since 5.3
*/
public MultipartEntityBuilder addEpilogue(final String epilogue) {

View File

@ -225,6 +225,8 @@ public class H2AsyncClientBuilder {
/**
* Sets {@link H2Config} configuration.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setH2Config(final H2Config h2Config) {
this.h2Config = h2Config;
@ -233,6 +235,8 @@ public class H2AsyncClientBuilder {
/**
* Sets {@link IOReactorConfig} configuration.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setIOReactorConfig(final IOReactorConfig ioReactorConfig) {
this.ioReactorConfig = ioReactorConfig;
@ -242,6 +246,7 @@ public class H2AsyncClientBuilder {
/**
* Sets {@link IOSessionListener} listener.
*
* @return this instance.
* @since 5.2
*/
public final H2AsyncClientBuilder setIOSessionListener(final IOSessionListener ioSessionListener) {
@ -251,6 +256,8 @@ public class H2AsyncClientBuilder {
/**
* Sets {@link CharCodingConfig} configuration.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
this.charCodingConfig = charCodingConfig;
@ -260,6 +267,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for target
* host authentication.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setTargetAuthenticationStrategy(
final AuthenticationStrategy targetAuthStrategy) {
@ -270,6 +279,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for proxy
* authentication.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setProxyAuthenticationStrategy(
final AuthenticationStrategy proxyAuthStrategy) {
@ -280,6 +291,7 @@ public class H2AsyncClientBuilder {
/**
* Sets the callback that will be invoked when the client's IOReactor encounters an uncaught exception.
*
* @return this instance.
* @since 5.2
*/
public final H2AsyncClientBuilder setIoReactorExceptionCallback(final Callback<Exception> ioReactorExceptionCallback) {
@ -291,6 +303,7 @@ public class H2AsyncClientBuilder {
/**
* Sets the {@link IOSession} {@link Decorator} that will be use with the client's IOReactor.
*
* @return this instance.
* @since 5.2
*/
public final H2AsyncClientBuilder setIoSessionDecorator(final Decorator<IOSession> ioSessionDecorator) {
@ -300,6 +313,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addResponseInterceptorFirst(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -312,6 +327,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -324,6 +341,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this execution interceptor before an existing interceptor.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addExecInterceptorBefore(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -338,6 +357,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this execution interceptor after interceptor with the given name.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addExecInterceptorAfter(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -352,6 +373,8 @@ public class H2AsyncClientBuilder {
/**
* Replace an existing interceptor with the given name with new interceptor.
*
* @return this instance.
*/
public final H2AsyncClientBuilder replaceExecInterceptor(final String existing, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -365,6 +388,8 @@ public class H2AsyncClientBuilder {
/**
* Add an interceptor to the head of the processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addExecInterceptorFirst(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -378,6 +403,8 @@ public class H2AsyncClientBuilder {
/**
* Add an interceptor to the tail of the processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addExecInterceptorLast(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -391,6 +418,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -403,6 +432,8 @@ public class H2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final H2AsyncClientBuilder addRequestInterceptorLast(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -418,6 +449,9 @@ public class H2AsyncClientBuilder {
* <p>
* Please note this value can be overridden by the {@link #disableAutomaticRetries()}
* method.
* </p>
*
* @return this instance.
*/
public final H2AsyncClientBuilder setRetryStrategy(final HttpRequestRetryStrategy retryStrategy) {
this.retryStrategy = retryStrategy;
@ -430,6 +464,8 @@ public class H2AsyncClientBuilder {
* Please note this value can be overridden by the {@link #disableRedirectHandling()}
* method.
* </p>
*
* @return this instance.
*/
public H2AsyncClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
this.redirectStrategy = redirectStrategy;
@ -438,6 +474,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
@ -446,6 +484,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link DnsResolver} instance.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDnsResolver(final DnsResolver dnsResolver) {
this.dnsResolver = dnsResolver;
@ -454,6 +494,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link TlsStrategy} instance.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setTlsStrategy(final TlsStrategy tlsStrategy) {
this.tlsStrategy = tlsStrategy;
@ -462,6 +504,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link ThreadFactory} instance.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setThreadFactory(final ThreadFactory threadFactory) {
this.threadFactory = threadFactory;
@ -470,6 +514,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@code User-Agent} value.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setUserAgent(final String userAgent) {
this.userAgent = userAgent;
@ -478,6 +524,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns default request header values.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
this.defaultHeaders = defaultHeaders;
@ -486,6 +534,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link HttpRoutePlanner} instance.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
this.routePlanner = routePlanner;
@ -496,6 +546,8 @@ public class H2AsyncClientBuilder {
* Assigns default {@link CredentialsProvider} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
this.credentialsProvider = credentialsProvider;
@ -506,6 +558,8 @@ public class H2AsyncClientBuilder {
* Assigns default {@link org.apache.hc.client5.http.auth.AuthScheme} registry which will
* be used for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultAuthSchemeRegistry(final Lookup<AuthSchemeFactory> authSchemeRegistry) {
this.authSchemeRegistry = authSchemeRegistry;
@ -516,6 +570,8 @@ public class H2AsyncClientBuilder {
* Assigns default {@link org.apache.hc.client5.http.cookie.CookieSpec} registry
* which will be used for request execution if not explicitly set in the client
* execution context.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultCookieSpecRegistry(final Lookup<CookieSpecFactory> cookieSpecRegistry) {
this.cookieSpecRegistry = cookieSpecRegistry;
@ -525,6 +581,8 @@ public class H2AsyncClientBuilder {
/**
* Assigns default {@link CookieStore} instance which will be used for
* request execution if not explicitly set in the client execution context.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
@ -535,6 +593,8 @@ public class H2AsyncClientBuilder {
* Assigns default {@link RequestConfig} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final H2AsyncClientBuilder setDefaultRequestConfig(final RequestConfig config) {
this.defaultRequestConfig = config;
@ -544,6 +604,7 @@ public class H2AsyncClientBuilder {
/**
* Assigns {@link Resolver} for {@link ConnectionConfig} on a per host basis.
*
* @return this instance.
* @since 5.2
*/
public final H2AsyncClientBuilder setConnectionConfigResolver(final Resolver<HttpHost, ConnectionConfig> connectionConfigResolver) {
@ -554,6 +615,7 @@ public class H2AsyncClientBuilder {
/**
* Assigns the same {@link ConnectionConfig} for all hosts.
*
* @return this instance.
* @since 5.2
*/
public final H2AsyncClientBuilder setDefaultConnectionConfig(final ConnectionConfig connectionConfig) {
@ -564,6 +626,8 @@ public class H2AsyncClientBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final H2AsyncClientBuilder useSystemProperties() {
this.systemProperties = true;
@ -572,6 +636,8 @@ public class H2AsyncClientBuilder {
/**
* Disables automatic redirect handling.
*
* @return this instance.
*/
public final H2AsyncClientBuilder disableRedirectHandling() {
redirectHandlingDisabled = true;
@ -580,6 +646,8 @@ public class H2AsyncClientBuilder {
/**
* Disables automatic request recovery and re-execution.
*
* @return this instance.
*/
public final H2AsyncClientBuilder disableAutomaticRetries() {
automaticRetriesDisabled = true;
@ -588,6 +656,8 @@ public class H2AsyncClientBuilder {
/**
* Disables state (cookie) management.
*
* @return this instance.
*/
public final H2AsyncClientBuilder disableCookieManagement() {
this.cookieManagementDisabled = true;
@ -596,6 +666,8 @@ public class H2AsyncClientBuilder {
/**
* Disables authentication scheme caching.
*
* @return this instance.
*/
public final H2AsyncClientBuilder disableAuthCaching() {
this.authCachingDisabled = true;
@ -608,13 +680,17 @@ public class H2AsyncClientBuilder {
* <p>
* One MUST explicitly close HttpClient with {@link CloseableHttpAsyncClient#close()}
* in order to stop and release the background thread.
* </p>
* <p>
* Please note this method has no effect if the instance of HttpClient is configured to
* use a shared connection manager.
* </p>
*
* @param maxIdleTime maximum time persistent connections can stay idle while kept alive
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
*
* @return this instance.
*/
public final H2AsyncClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
this.evictIdleConnections = true;
@ -626,6 +702,7 @@ public class H2AsyncClientBuilder {
* Request exec chain customization and extension.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void customizeExecChain(final NamedElementChain<AsyncExecChainHandler> execChainDefinition) {
@ -635,6 +712,7 @@ public class H2AsyncClientBuilder {
* Adds to the list of {@link Closeable} resources to be managed by the client.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void addCloseable(final Closeable closeable) {

View File

@ -270,6 +270,7 @@ public class HttpAsyncClientBuilder {
/**
* Sets HTTP protocol version policy.
*
* @return this instance.
* @deprecated Use {@link TlsConfig} and connection manager methods
*/
@Deprecated
@ -280,6 +281,8 @@ public class HttpAsyncClientBuilder {
/**
* Sets {@link Http1Config} configuration.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setHttp1Config(final Http1Config h1Config) {
this.h1Config = h1Config;
@ -288,6 +291,8 @@ public class HttpAsyncClientBuilder {
/**
* Sets {@link H2Config} configuration.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setH2Config(final H2Config h2Config) {
this.h2Config = h2Config;
@ -296,6 +301,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link AsyncClientConnectionManager} instance.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setConnectionManager(final AsyncClientConnectionManager connManager) {
this.connManager = connManager;
@ -309,9 +316,12 @@ public class HttpAsyncClientBuilder {
* If the connection manager is shared its life-cycle is expected
* to be managed by the caller and it will not be shut down
* if the client is closed.
* </p>
*
* @param shared defines whether or not the connection manager can be shared
* by multiple clients.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setConnectionManagerShared(final boolean shared) {
this.connManagerShared = shared;
@ -320,6 +330,8 @@ public class HttpAsyncClientBuilder {
/**
* Sets {@link IOReactorConfig} configuration.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setIOReactorConfig(final IOReactorConfig ioReactorConfig) {
this.ioReactorConfig = ioReactorConfig;
@ -329,6 +341,7 @@ public class HttpAsyncClientBuilder {
/**
* Sets {@link IOSessionListener} listener.
*
* @return this instance.
* @since 5.2
*/
public final HttpAsyncClientBuilder setIOSessionListener(final IOSessionListener ioSessionListener) {
@ -339,6 +352,7 @@ public class HttpAsyncClientBuilder {
/**
* Sets the callback that will be invoked when the client's IOReactor encounters an uncaught exception.
*
* @return this instance.
* @since 5.1
*/
public final HttpAsyncClientBuilder setIoReactorExceptionCallback(final Callback<Exception> ioReactorExceptionCallback) {
@ -348,6 +362,8 @@ public class HttpAsyncClientBuilder {
/**
* Sets {@link CharCodingConfig} configuration.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
this.charCodingConfig = charCodingConfig;
@ -358,6 +374,9 @@ public class HttpAsyncClientBuilder {
* Assigns {@link ConnectionReuseStrategy} instance.
* <p>
* Please note this strategy applies to HTTP/1.0 and HTTP/1.1 connections only
* </p>
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setConnectionReuseStrategy(final ConnectionReuseStrategy reuseStrategy) {
this.reuseStrategy = reuseStrategy;
@ -366,6 +385,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link ConnectionKeepAliveStrategy} instance.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setKeepAliveStrategy(final ConnectionKeepAliveStrategy keepAliveStrategy) {
this.keepAliveStrategy = keepAliveStrategy;
@ -378,6 +399,8 @@ public class HttpAsyncClientBuilder {
* Please note this value can be overridden by the {@link #disableConnectionState()}
* method.
* </p>
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setUserTokenHandler(final UserTokenHandler userTokenHandler) {
this.userTokenHandler = userTokenHandler;
@ -387,6 +410,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for target
* host authentication.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setTargetAuthenticationStrategy(
final AuthenticationStrategy targetAuthStrategy) {
@ -397,6 +422,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for proxy
* authentication.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setProxyAuthenticationStrategy(
final AuthenticationStrategy proxyAuthStrategy) {
@ -407,6 +434,7 @@ public class HttpAsyncClientBuilder {
/**
* Sets the {@link IOSession} {@link Decorator} that will be use with the client's IOReactor.
*
* @return this instance.
* @since 5.2
*/
public final HttpAsyncClientBuilder setIoSessionDecorator(final Decorator<IOSession> ioSessionDecorator) {
@ -416,6 +444,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addResponseInterceptorFirst(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -428,6 +458,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -440,6 +472,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this execution interceptor before an existing interceptor.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addExecInterceptorBefore(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -454,6 +488,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this execution interceptor after interceptor with the given name.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addExecInterceptorAfter(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -468,6 +504,8 @@ public class HttpAsyncClientBuilder {
/**
* Replace an existing interceptor with the given name with new interceptor.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder replaceExecInterceptor(final String existing, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -481,6 +519,8 @@ public class HttpAsyncClientBuilder {
/**
* Add an interceptor to the head of the processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addExecInterceptorFirst(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -494,6 +534,8 @@ public class HttpAsyncClientBuilder {
/**
* Add an interceptor to the tail of the processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addExecInterceptorLast(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -507,6 +549,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -519,6 +563,8 @@ public class HttpAsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder addRequestInterceptorLast(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -534,6 +580,9 @@ public class HttpAsyncClientBuilder {
* <p>
* Please note this value can be overridden by the {@link #disableAutomaticRetries()}
* method.
* </p>
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setRetryStrategy(final HttpRequestRetryStrategy retryStrategy) {
this.retryStrategy = retryStrategy;
@ -546,6 +595,8 @@ public class HttpAsyncClientBuilder {
* Please note this value can be overridden by the {@link #disableRedirectHandling()}
* method.
* </p>
*
* @return this instance.
*/
public HttpAsyncClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
this.redirectStrategy = redirectStrategy;
@ -554,6 +605,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
@ -562,6 +615,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link ThreadFactory} instance.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setThreadFactory(final ThreadFactory threadFactory) {
this.threadFactory = threadFactory;
@ -570,6 +625,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@code User-Agent} value.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setUserAgent(final String userAgent) {
this.userAgent = userAgent;
@ -578,6 +635,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns default request header values.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
this.defaultHeaders = defaultHeaders;
@ -585,13 +644,13 @@ public class HttpAsyncClientBuilder {
}
/**
* Sets the {@link java.net.ProxySelector} that will be used to select the proxies
* Sets the {@link ProxySelector} that will be used to select the proxies
* to be used for establishing HTTP connections. If a non-null proxy selector is set,
* it will take precedence over the proxy settings configured in the client.
*
* @param proxySelector the {@link java.net.ProxySelector} to be used, or null to use
* @param proxySelector the {@link ProxySelector} to be used, or null to use
* the default system proxy selector.
* @return this {@link HttpAsyncClientBuilder} instance, to allow for method chaining.
* @return this instance.
*/
public final HttpAsyncClientBuilder setProxySelector(final ProxySelector proxySelector) {
this.proxySelector = proxySelector;
@ -603,6 +662,8 @@ public class HttpAsyncClientBuilder {
* <p>
* Please note this value can be overridden by the {@link #setRoutePlanner(
* HttpRoutePlanner)} method.
* </p>
* @return this instance.
*/
public final HttpAsyncClientBuilder setProxy(final HttpHost proxy) {
this.proxy = proxy;
@ -611,6 +672,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns {@link HttpRoutePlanner} instance.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
this.routePlanner = routePlanner;
@ -621,6 +684,8 @@ public class HttpAsyncClientBuilder {
* Assigns default {@link CredentialsProvider} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
this.credentialsProvider = credentialsProvider;
@ -631,6 +696,8 @@ public class HttpAsyncClientBuilder {
* Assigns default {@link org.apache.hc.client5.http.auth.AuthScheme} registry which will
* be used for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultAuthSchemeRegistry(final Lookup<AuthSchemeFactory> authSchemeRegistry) {
this.authSchemeRegistry = authSchemeRegistry;
@ -641,6 +708,8 @@ public class HttpAsyncClientBuilder {
* Assigns default {@link org.apache.hc.client5.http.cookie.CookieSpec} registry
* which will be used for request execution if not explicitly set in the client
* execution context.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultCookieSpecRegistry(final Lookup<CookieSpecFactory> cookieSpecRegistry) {
this.cookieSpecRegistry = cookieSpecRegistry;
@ -650,6 +719,8 @@ public class HttpAsyncClientBuilder {
/**
* Assigns default {@link CookieStore} instance which will be used for
* request execution if not explicitly set in the client execution context.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
@ -660,6 +731,8 @@ public class HttpAsyncClientBuilder {
* Assigns default {@link RequestConfig} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder setDefaultRequestConfig(final RequestConfig config) {
this.defaultRequestConfig = config;
@ -669,6 +742,8 @@ public class HttpAsyncClientBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder useSystemProperties() {
this.systemProperties = true;
@ -677,6 +752,8 @@ public class HttpAsyncClientBuilder {
/**
* Disables connection state tracking.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder disableConnectionState() {
connectionStateDisabled = true;
@ -685,6 +762,8 @@ public class HttpAsyncClientBuilder {
/**
* Disables automatic redirect handling.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder disableRedirectHandling() {
redirectHandlingDisabled = true;
@ -693,6 +772,8 @@ public class HttpAsyncClientBuilder {
/**
* Disables automatic request recovery and re-execution.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder disableAutomaticRetries() {
automaticRetriesDisabled = true;
@ -701,6 +782,8 @@ public class HttpAsyncClientBuilder {
/**
* Disables state (cookie) management.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder disableCookieManagement() {
this.cookieManagementDisabled = true;
@ -709,6 +792,8 @@ public class HttpAsyncClientBuilder {
/**
* Disables authentication scheme caching.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder disableAuthCaching() {
this.authCachingDisabled = true;
@ -727,6 +812,8 @@ public class HttpAsyncClientBuilder {
*
* @see #setConnectionManagerShared(boolean)
* @see ConnPoolControl#closeExpired()
*
* @return this instance.
*/
public final HttpAsyncClientBuilder evictExpiredConnections() {
evictExpiredConnections = true;
@ -749,6 +836,8 @@ public class HttpAsyncClientBuilder {
* @param maxIdleTime maximum time persistent connections can stay idle while kept alive
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
*
* @return this instance.
*/
public final HttpAsyncClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
this.evictIdleConnections = true;
@ -760,6 +849,7 @@ public class HttpAsyncClientBuilder {
* Request exec chain customization and extension.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void customizeExecChain(final NamedElementChain<AsyncExecChainHandler> execChainDefinition) {
@ -769,6 +859,7 @@ public class HttpAsyncClientBuilder {
* Adds to the list of {@link Closeable} resources to be managed by the client.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void addCloseable(final Closeable closeable) {

View File

@ -26,6 +26,7 @@
*/
package org.apache.hc.client5.http.impl.auth;
import java.io.Serializable;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory;
/**
* Default implementation of {@link AuthCache}. This implements
* expects {@link org.apache.hc.client5.http.auth.AuthScheme} to be {@link java.io.Serializable}
* expects {@link AuthScheme} to be {@link Serializable}
* in order to be cacheable.
* <p>
* Instances of this class are thread safe as of version 4.4.

View File

@ -31,6 +31,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.zip.GZIPInputStream;
import org.apache.hc.client5.http.classic.ExecChain;
import org.apache.hc.client5.http.classic.ExecChainHandler;
@ -38,6 +39,7 @@ import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.entity.BrotliDecompressingEntity;
import org.apache.hc.client5.http.entity.BrotliInputStreamFactory;
import org.apache.hc.client5.http.entity.DecompressingEntity;
import org.apache.hc.client5.http.entity.DeflateInputStream;
import org.apache.hc.client5.http.entity.DeflateInputStreamFactory;
import org.apache.hc.client5.http.entity.GZIPInputStreamFactory;
import org.apache.hc.client5.http.entity.InputStreamFactory;
@ -58,6 +60,7 @@ import org.apache.hc.core5.http.message.BasicHeaderValueParser;
import org.apache.hc.core5.http.message.MessageSupport;
import org.apache.hc.core5.http.message.ParserCursor;
import org.apache.hc.core5.util.Args;
import org.brotli.dec.BrotliInputStream;
/**
* Request execution handler in the classic request execution chain
@ -118,9 +121,9 @@ public final class ContentCompressionExec implements ExecChainHandler {
* Handles {@code gzip} and {@code deflate} compressed entities by using the following
* decoders:
* <ul>
* <li>gzip - see {@link java.util.zip.GZIPInputStream}</li>
* <li>deflate - see {@link org.apache.hc.client5.http.entity.DeflateInputStream}</li>
* <li>brotli - see {@link org.brotli.dec.BrotliInputStream}</li>
* <li>gzip - see {@link GZIPInputStream}</li>
* <li>deflate - see {@link DeflateInputStream}</li>
* <li>brotli - see {@link BrotliInputStream}</li>
* </ul>
*/
public ContentCompressionExec() {

View File

@ -29,6 +29,7 @@ package org.apache.hc.client5.http.impl.classic;
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean;
@ -55,7 +56,7 @@ public class FutureRequestExecutionService implements Closeable {
/**
* Create a new FutureRequestExecutionService.
*
* @param httpclient
* @param httpClient
* you should tune your httpclient instance to match your needs. You should
* align the max number of connections in the pool and the number of threads
* in the executor; it doesn't make sense to have more threads than connections
@ -63,12 +64,12 @@ public class FutureRequestExecutionService implements Closeable {
* blocking on getting a connection from the pool.
* @param executorService
* any executorService will do here. E.g.
* {@link java.util.concurrent.Executors#newFixedThreadPool(int)}
* {@link Executors#newFixedThreadPool(int)}
*/
public FutureRequestExecutionService(
final HttpClient httpclient,
final HttpClient httpClient,
final ExecutorService executorService) {
this.httpclient = httpclient;
this.httpclient = httpClient;
this.executorService = executorService;
}

View File

@ -244,6 +244,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link HttpRequestExecutor} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setRequestExecutor(final HttpRequestExecutor requestExec) {
this.requestExec = requestExec;
@ -252,6 +254,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link HttpClientConnectionManager} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setConnectionManager(
final HttpClientConnectionManager connManager) {
@ -270,6 +274,7 @@ public class HttpClientBuilder {
*
* @param shared defines whether or not the connection manager can be shared
* by multiple clients.
* @return this instance.
*
* @since 4.4
*/
@ -281,6 +286,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link ConnectionReuseStrategy} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setConnectionReuseStrategy(
final ConnectionReuseStrategy reuseStrategy) {
@ -290,6 +297,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link ConnectionKeepAliveStrategy} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setKeepAliveStrategy(
final ConnectionKeepAliveStrategy keepAliveStrategy) {
@ -300,6 +309,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for target
* host authentication.
*
* @return this instance.
*/
public final HttpClientBuilder setTargetAuthenticationStrategy(
final AuthenticationStrategy targetAuthStrategy) {
@ -310,6 +321,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link AuthenticationStrategy} instance for proxy
* authentication.
*
* @return this instance.
*/
public final HttpClientBuilder setProxyAuthenticationStrategy(
final AuthenticationStrategy proxyAuthStrategy) {
@ -323,6 +336,8 @@ public class HttpClientBuilder {
* Please note this value can be overridden by the {@link #disableConnectionState()}
* method.
* </p>
*
* @return this instance.
*/
public final HttpClientBuilder setUserTokenHandler(final UserTokenHandler userTokenHandler) {
this.userTokenHandler = userTokenHandler;
@ -331,6 +346,8 @@ public class HttpClientBuilder {
/**
* Disables connection state tracking.
*
* @return this instance.
*/
public final HttpClientBuilder disableConnectionState() {
connectionStateDisabled = true;
@ -339,6 +356,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setSchemePortResolver(
final SchemePortResolver schemePortResolver) {
@ -348,6 +367,8 @@ public class HttpClientBuilder {
/**
* Assigns {@code User-Agent} value.
*
* @return this instance.
*/
public final HttpClientBuilder setUserAgent(final String userAgent) {
this.userAgent = userAgent;
@ -356,6 +377,8 @@ public class HttpClientBuilder {
/**
* Assigns default request header values.
*
* @return this instance.
*/
public final HttpClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
this.defaultHeaders = defaultHeaders;
@ -364,6 +387,8 @@ public class HttpClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addResponseInterceptorFirst(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -376,6 +401,8 @@ public class HttpClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -388,6 +415,8 @@ public class HttpClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -400,6 +429,8 @@ public class HttpClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addRequestInterceptorLast(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
@ -412,6 +443,8 @@ public class HttpClientBuilder {
/**
* Adds this execution interceptor before an existing interceptor.
*
* @return this instance.
*/
public final HttpClientBuilder addExecInterceptorBefore(final String existing, final String name, final ExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -426,6 +459,8 @@ public class HttpClientBuilder {
/**
* Adds this execution interceptor after interceptor with the given name.
*
* @return this instance.
*/
public final HttpClientBuilder addExecInterceptorAfter(final String existing, final String name, final ExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -440,6 +475,8 @@ public class HttpClientBuilder {
/**
* Replace an existing interceptor with the given name with new interceptor.
*
* @return this instance.
*/
public final HttpClientBuilder replaceExecInterceptor(final String existing, final ExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
@ -453,6 +490,8 @@ public class HttpClientBuilder {
/**
* Add an interceptor to the head of the processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addExecInterceptorFirst(final String name, final ExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -466,6 +505,8 @@ public class HttpClientBuilder {
/**
* Add an interceptor to the tail of the processing list.
*
* @return this instance.
*/
public final HttpClientBuilder addExecInterceptorLast(final String name, final ExecChainHandler interceptor) {
Args.notNull(name, "Name");
@ -479,6 +520,8 @@ public class HttpClientBuilder {
/**
* Disables state (cookie) management.
*
* @return this instance.
*/
public final HttpClientBuilder disableCookieManagement() {
this.cookieManagementDisabled = true;
@ -487,6 +530,8 @@ public class HttpClientBuilder {
/**
* Disables automatic content decompression.
*
* @return this instance.
*/
public final HttpClientBuilder disableContentCompression() {
contentCompressionDisabled = true;
@ -495,6 +540,8 @@ public class HttpClientBuilder {
/**
* Disables authentication scheme caching.
*
* @return this instance.
*/
public final HttpClientBuilder disableAuthCaching() {
this.authCachingDisabled = true;
@ -506,6 +553,9 @@ public class HttpClientBuilder {
* <p>
* Please note this value can be overridden by the {@link #disableAutomaticRetries()}
* method.
* </p>
*
* @return this instance.
*/
public final HttpClientBuilder setRetryStrategy(final HttpRequestRetryStrategy retryStrategy) {
this.retryStrategy = retryStrategy;
@ -514,6 +564,8 @@ public class HttpClientBuilder {
/**
* Disables automatic request recovery and re-execution.
*
* @return this instance.
*/
public final HttpClientBuilder disableAutomaticRetries() {
automaticRetriesDisabled = true;
@ -525,6 +577,9 @@ public class HttpClientBuilder {
* <p>
* Please note this value can be overridden by the {@link #setRoutePlanner(
* org.apache.hc.client5.http.routing.HttpRoutePlanner)} method.
* </p>
*
* @return this instance.
*/
public final HttpClientBuilder setProxy(final HttpHost proxy) {
this.proxy = proxy;
@ -545,7 +600,9 @@ public class HttpClientBuilder {
* Please note this value can be overridden by the {@link #disableRedirectHandling()}
* method.
* </p>
` */
*
* @return this instance.
*/
public final HttpClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
this.redirectStrategy = redirectStrategy;
return this;
@ -553,6 +610,8 @@ public class HttpClientBuilder {
/**
* Disables automatic redirect handling.
*
* @return this instance.
*/
public final HttpClientBuilder disableRedirectHandling() {
redirectHandlingDisabled = true;
@ -561,6 +620,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link ConnectionBackoffStrategy} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setConnectionBackoffStrategy(
final ConnectionBackoffStrategy connectionBackoffStrategy) {
@ -570,6 +631,8 @@ public class HttpClientBuilder {
/**
* Assigns {@link BackoffManager} instance.
*
* @return this instance.
*/
public final HttpClientBuilder setBackoffManager(final BackoffManager backoffManager) {
this.backoffManager = backoffManager;
@ -579,6 +642,8 @@ public class HttpClientBuilder {
/**
* Assigns default {@link CookieStore} instance which will be used for
* request execution if not explicitly set in the client execution context.
*
* @return this instance.
*/
public final HttpClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
@ -589,6 +654,8 @@ public class HttpClientBuilder {
* Assigns default {@link CredentialsProvider} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpClientBuilder setDefaultCredentialsProvider(
final CredentialsProvider credentialsProvider) {
@ -600,6 +667,8 @@ public class HttpClientBuilder {
* Assigns default {@link org.apache.hc.client5.http.auth.AuthScheme} registry which will
* be used for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpClientBuilder setDefaultAuthSchemeRegistry(
final Lookup<AuthSchemeFactory> authSchemeRegistry) {
@ -612,8 +681,8 @@ public class HttpClientBuilder {
* be used for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
* @see CookieSpecSupport
*
*/
public final HttpClientBuilder setDefaultCookieSpecRegistry(
final Lookup<CookieSpecFactory> cookieSpecRegistry) {
@ -625,6 +694,8 @@ public class HttpClientBuilder {
/**
* Assigns a map of {@link org.apache.hc.client5.http.entity.InputStreamFactory}s
* to be used for automatic content decompression.
*
* @return this instance.
*/
public final HttpClientBuilder setContentDecoderRegistry(
final LinkedHashMap<String, InputStreamFactory> contentDecoderMap) {
@ -636,6 +707,8 @@ public class HttpClientBuilder {
* Assigns default {@link RequestConfig} instance which will be used
* for request execution if not explicitly set in the client execution
* context.
*
* @return this instance.
*/
public final HttpClientBuilder setDefaultRequestConfig(final RequestConfig config) {
this.defaultRequestConfig = config;
@ -645,6 +718,8 @@ public class HttpClientBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final HttpClientBuilder useSystemProperties() {
this.systemProperties = true;
@ -657,10 +732,13 @@ public class HttpClientBuilder {
* <p>
* One MUST explicitly close HttpClient with {@link CloseableHttpClient#close()} in order
* to stop and release the background thread.
* </p>
* <p>
* Please note this method has no effect if the instance of HttpClient is configured to
* use a shared connection manager.
* </p>
*
* @return this instance.
* @see #setConnectionManagerShared(boolean)
* @see ConnPoolControl#closeExpired()
*
@ -677,9 +755,11 @@ public class HttpClientBuilder {
* <p>
* One MUST explicitly close HttpClient with {@link CloseableHttpClient#close()} in order
* to stop and release the background thread.
* </p>
* <p>
* Please note this method has no effect if the instance of HttpClient is configured to
* use a shared connection manager.
* </p>
*
* @see #setConnectionManagerShared(boolean)
* @see ConnPoolControl#closeIdle(TimeValue)
@ -688,6 +768,7 @@ public class HttpClientBuilder {
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
*
* @return this instance.
* @since 4.4
*/
public final HttpClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
@ -699,6 +780,7 @@ public class HttpClientBuilder {
/**
* Disables the default user agent set by this builder if none has been provided by the user.
*
* @return this instance.
* @since 4.5.7
*/
public final HttpClientBuilder disableDefaultUserAgent() {
@ -707,13 +789,13 @@ public class HttpClientBuilder {
}
/**
* Sets the {@link java.net.ProxySelector} that will be used to select the proxies
* Sets the {@link ProxySelector} that will be used to select the proxies
* to be used for establishing HTTP connections. If a non-null proxy selector is set,
* it will take precedence over the proxy settings configured in the client.
*
* @param proxySelector the {@link java.net.ProxySelector} to be used, or null to use
* @param proxySelector the {@link ProxySelector} to be used, or null to use
* the default system proxy selector.
* @return this {@link HttpClientBuilder} instance, to allow for method chaining.
* @return this instance.
*/
public final HttpClientBuilder setProxySelector(final ProxySelector proxySelector) {
this.proxySelector = proxySelector;
@ -724,6 +806,7 @@ public class HttpClientBuilder {
* Request exec chain customization and extension.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void customizeExecChain(final NamedElementChain<ExecChainHandler> execChainDefinition) {
@ -733,6 +816,7 @@ public class HttpClientBuilder {
* Adds to the list of {@link Closeable} resources to be managed by the client.
* <p>
* For internal use.
* </p>
*/
@Internal
protected void addCloseable(final Closeable closeable) {

View File

@ -103,6 +103,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link HttpConnectionFactory} instance.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setConnectionFactory(
final HttpConnectionFactory<ManagedHttpClientConnection> connectionFactory) {
@ -113,6 +115,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory} instance.
*
* @return this instance.
* @deprecated Use {@link #setTlsSocketStrategy(TlsSocketStrategy)}
*/
@Deprecated
@ -125,6 +128,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link TlsSocketStrategy} instance.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setTlsSocketStrategy(final TlsSocketStrategy tlsSocketStrategy) {
this.tlsSocketStrategy = tlsSocketStrategy;
@ -133,6 +138,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link DnsResolver} instance.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setDnsResolver(final DnsResolver dnsResolver) {
this.dnsResolver = dnsResolver;
@ -141,6 +148,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
@ -149,6 +158,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link PoolConcurrencyPolicy} value.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setPoolConcurrencyPolicy(final PoolConcurrencyPolicy poolConcurrencyPolicy) {
this.poolConcurrencyPolicy = poolConcurrencyPolicy;
@ -157,6 +168,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link PoolReusePolicy} value.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setConnPoolPolicy(final PoolReusePolicy poolReusePolicy) {
this.poolReusePolicy = poolReusePolicy;
@ -165,6 +178,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns maximum total connection value.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setMaxConnTotal(final int maxConnTotal) {
this.maxConnTotal = maxConnTotal;
@ -173,6 +188,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns maximum connection per route value.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setMaxConnPerRoute(final int maxConnPerRoute) {
this.maxConnPerRoute = maxConnPerRoute;
@ -181,6 +198,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns the same {@link SocketConfig} for all routes.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultSocketConfig(final SocketConfig config) {
this.socketConfigResolver = (route) -> config;
@ -190,6 +209,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link Resolver} of {@link SocketConfig} on a per route basis.
*
* @return this instance.
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setSocketConfigResolver(
@ -201,6 +221,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns the same {@link ConnectionConfig} for all routes.
*
* @return this instance.
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultConnectionConfig(final ConnectionConfig config) {
@ -211,6 +232,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link Resolver} of {@link ConnectionConfig} on a per route basis.
*
* @return this instance.
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setConnectionConfigResolver(
@ -222,6 +244,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns the same {@link TlsConfig} for all hosts.
*
* @return this instance.
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setDefaultTlsConfig(final TlsConfig config) {
@ -232,6 +255,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Assigns {@link Resolver} of {@link TlsConfig} on a per host basis.
*
* @return this instance.
* @since 5.2
*/
public final PoolingHttpClientConnectionManagerBuilder setTlsConfigResolver(
@ -243,6 +267,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Sets maximum time to live for persistent connections
*
* @return this instance.
* @deprecated Use {@link #setDefaultConnectionConfig(ConnectionConfig)}.
*/
@Deprecated
@ -257,6 +282,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
* Sets period after inactivity after which persistent
* connections must be checked to ensure they are still valid.
*
* @return this instance.
* @deprecated Use {@link #setDefaultConnectionConfig(ConnectionConfig)}.
*/
@Deprecated
@ -270,6 +296,8 @@ public class PoolingHttpClientConnectionManagerBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final PoolingHttpClientConnectionManagerBuilder useSystemProperties() {
this.systemProperties = true;

View File

@ -99,6 +99,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link TlsStrategy} instance for TLS connections.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setTlsStrategy(
final TlsStrategy tlsStrategy) {
@ -108,6 +110,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link DnsResolver} instance.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setDnsResolver(final DnsResolver dnsResolver) {
this.dnsResolver = dnsResolver;
@ -116,6 +120,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
@ -124,6 +130,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link PoolConcurrencyPolicy} value.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setPoolConcurrencyPolicy(final PoolConcurrencyPolicy poolConcurrencyPolicy) {
this.poolConcurrencyPolicy = poolConcurrencyPolicy;
@ -132,6 +140,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link PoolReusePolicy} value.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setConnPoolPolicy(final PoolReusePolicy poolReusePolicy) {
this.poolReusePolicy = poolReusePolicy;
@ -140,6 +150,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns maximum total connection value.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setMaxConnTotal(final int maxConnTotal) {
this.maxConnTotal = maxConnTotal;
@ -148,6 +160,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns maximum connection per route value.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder setMaxConnPerRoute(final int maxConnPerRoute) {
this.maxConnPerRoute = maxConnPerRoute;
@ -157,6 +171,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns the same {@link ConnectionConfig} for all routes.
*
* @return this instance.
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setDefaultConnectionConfig(final ConnectionConfig config) {
@ -167,6 +182,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link Resolver} of {@link ConnectionConfig} on a per route basis.
*
* @return this instance.
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setConnectionConfigResolver(
@ -178,6 +194,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns the same {@link TlsConfig} for all hosts.
*
* @return this instance.
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setDefaultTlsConfig(final TlsConfig config) {
@ -188,6 +205,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Assigns {@link Resolver} of {@link TlsConfig} on a per host basis.
*
* @return this instance.
* @since 5.2
*/
public final PoolingAsyncClientConnectionManagerBuilder setTlsConfigResolver(
@ -199,6 +217,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Sets maximum time to live for persistent connections
*
* @return this instance.
* @deprecated Use {@link #setDefaultConnectionConfig(ConnectionConfig)}
*/
@Deprecated
@ -213,6 +232,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
* Sets period after inactivity after which persistent
* connections must be checked to ensure they are still valid.
*
* @return this instance.
* @deprecated Use {@link #setConnectionConfigResolver(Resolver)}.
*/
@Deprecated
@ -226,6 +246,8 @@ public class PoolingAsyncClientConnectionManagerBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final PoolingAsyncClientConnectionManagerBuilder useSystemProperties() {
this.systemProperties = true;

View File

@ -34,7 +34,7 @@ import java.util.List;
import java.util.Set;
/**
* This class represents a collection of {@link java.net.URI}s used
* This class represents a collection of {@link URI}s used
* as redirect locations.
*
* @since 4.0
@ -44,6 +44,9 @@ public final class RedirectLocations {
private final Set<URI> unique;
private final List<URI> all;
/**
* Constructs a new instance.
*/
public RedirectLocations() {
super();
this.unique = new HashSet<>();

View File

@ -80,6 +80,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns {@link SSLContext} instance.
*
* @return this instance.
*/
public ClientTlsStrategyBuilder setSslContext(final SSLContext sslContext) {
this.sslContext = sslContext;
@ -88,6 +90,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns enabled {@code TLS} versions.
*
* @return this instance.
*/
public final ClientTlsStrategyBuilder setTlsVersions(final String... tlslVersions) {
this.tlsVersions = tlslVersions;
@ -96,6 +100,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns enabled {@code TLS} versions.
*
* @return this instance.
*/
public final ClientTlsStrategyBuilder setTlsVersions(final TLS... tlslVersions) {
this.tlsVersions = new String[tlslVersions.length];
@ -107,6 +113,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns enabled ciphers.
*
* @return this instance.
*/
public final ClientTlsStrategyBuilder setCiphers(final String... ciphers) {
this.ciphers = ciphers;
@ -115,6 +123,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns {@link SSLBufferMode} value.
*
* @return this instance.
*/
public ClientTlsStrategyBuilder setSslBufferMode(final SSLBufferMode sslBufferMode) {
this.sslBufferMode = sslBufferMode;
@ -130,6 +140,8 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns {@link HostnameVerifier} instance.
*
* @return this instance.
*/
public ClientTlsStrategyBuilder setHostnameVerifier(final HostnameVerifier hostnameVerifier) {
this.hostnameVerifier = hostnameVerifier;
@ -139,6 +151,7 @@ public class ClientTlsStrategyBuilder {
/**
* Assigns {@link TlsDetails} {@link Factory} instance.
*
* @return this instance.
* @deprecated Do not use. This method has no effect.
*/
@Deprecated
@ -149,6 +162,8 @@ public class ClientTlsStrategyBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final ClientTlsStrategyBuilder useSystemProperties() {
this.systemProperties = true;

View File

@ -74,6 +74,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Assigns {@link SSLContext} instance.
*
* @return this instance.
*/
public SSLConnectionSocketFactoryBuilder setSslContext(final SSLContext sslContext) {
this.sslContext = sslContext;
@ -82,6 +84,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Assigns enabled {@code TLS} versions.
*
* @return this instance.
*/
public final SSLConnectionSocketFactoryBuilder setTlsVersions(final String... tlslVersions) {
this.tlsVersions = tlslVersions;
@ -90,6 +94,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Assigns enabled {@code TLS} versions.
*
* @return this instance.
*/
public final SSLConnectionSocketFactoryBuilder setTlsVersions(final TLS... tlslVersions) {
this.tlsVersions = new String[tlslVersions.length];
@ -101,6 +107,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Assigns enabled ciphers.
*
* @return this instance.
*/
public final SSLConnectionSocketFactoryBuilder setCiphers(final String... ciphers) {
this.ciphers = ciphers;
@ -110,6 +118,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Assigns {@link HostnameVerifier} instance.
*
* @return this instance.
*/
public SSLConnectionSocketFactoryBuilder setHostnameVerifier(final HostnameVerifier hostnameVerifier) {
this.hostnameVerifier = hostnameVerifier;
@ -119,6 +129,8 @@ public class SSLConnectionSocketFactoryBuilder {
/**
* Use system properties when creating and configuring default
* implementations.
*
* @return this instance.
*/
public final SSLConnectionSocketFactoryBuilder useSystemProperties() {
this.systemProperties = true;