From 4007c05f9bdfcece4c770a32d2e5e96c970cdf4a Mon Sep 17 00:00:00 2001
From: "Gary D. Gregory"
* This connection manager will make an effort to reuse the connection for subsequent requests
* with the same {@link HttpRoute route}. It will, however, close the existing connection and
* open it for the given route, if the route of the persistent connection does not match that
* of the connection request. If the connection has been already been allocated
* {@link IllegalStateException} is thrown.
- *
* This connection manager implementation should be used inside an EJB container instead of * {@link PoolingClientConnectionManager}. + *
* * @since 4.2 * diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java index dc1e18cca..1506a5a3e 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java @@ -36,10 +36,10 @@ import org.apache.http.util.LangUtils; /** * {@code AuthScope} represents an authentication scope consisting of a host name, * a port number, a realm name and an authentication scheme name. - * + ** This class can also optionally contain a host of origin, if created in response * to authentication challenge from a specific host. - * + *
* @since 4.0 */ @Immutable diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthState.java b/httpclient/src/main/java/org/apache/http/auth/AuthState.java index 28bf7ba87..8419ed9dc 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthState.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthState.java @@ -198,7 +198,7 @@ public class AuthState { /** * Returns actual {@link AuthScope} if available * - * @return actual authentication scope if available,null
+ * * Implementing classes are required to ensure that the content entity * associated with the response is fully consumed and the underlying * connection is released back to the connection manager automatically * in all cases relieving individual {@link ResponseHandler}s from * having to manage resource deallocation internally. + *
* * @param request the request to execute * @param responseHandler the response handler @@ -176,12 +177,13 @@ public interface HttpClient { /** * Executes HTTP request using the given context and processes the * response using the given response handler. - * + ** Implementing classes are required to ensure that the content entity * associated with the response is fully consumed and the underlying * connection is released back to the connection manager automatically * in all cases relieving individual {@link ResponseHandler}s from * having to manage resource deallocation internally. + *
* * @param request the request to execute * @param responseHandler the response handler @@ -201,12 +203,13 @@ public interface HttpClient { /** * Executes HTTP request to the target using the default context and * processes the response using the given response handler. - * + ** Implementing classes are required to ensure that the content entity * associated with the response is fully consumed and the underlying * connection is released back to the connection manager automatically * in all cases relieving individual {@link ResponseHandler}s from * having to manage resource deallocation internally. + *
* * @param target the target host for the request. * Implementations may acceptnull
@@ -228,12 +231,13 @@ public interface HttpClient {
/**
* Executes HTTP request to the target using the given context and
* processes the response using the given response handler.
- *
+ * * Implementing classes are required to ensure that the content entity * associated with the response is fully consumed and the underlying * connection is released back to the connection manager automatically * in all cases relieving individual {@link ResponseHandler}s from * having to manage resource deallocation internally. + *
* * @param target the target host for the request. * Implementations may acceptnull
diff --git a/httpclient/src/main/java/org/apache/http/client/UserTokenHandler.java b/httpclient/src/main/java/org/apache/http/client/UserTokenHandler.java
index 5d8b1b800..efddb164c 100644
--- a/httpclient/src/main/java/org/apache/http/client/UserTokenHandler.java
+++ b/httpclient/src/main/java/org/apache/http/client/UserTokenHandler.java
@@ -35,9 +35,10 @@ import org.apache.http.protocol.HttpContext;
* identify the current user if the context is user specific or to be
* null
if the context does not contain any resources or details
* specific to the current user.
- *
+ * * The user token will be used to ensure that user specific resources will not * be shared with or reused by other users. + *
* * @since 4.0 */ diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java index 7a171b50c..0db9899af 100644 --- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java +++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java @@ -103,17 +103,20 @@ public class RequestConfig implements Cloneable { * a request body to determine if the origin server is willing to * accept the request (based on the request headers) before the client * sends the request body. - * + ** The use of the 'Expect: 100-continue' handshake can result in * a noticeable performance improvement for entity enclosing requests * (such as POST and PUT) that require the target server's * authentication. - *
+ * + ** 'Expect: 100-continue' handshake should be used with caution, as it * may cause problems with HTTP servers and proxies that do not support * HTTP/1.1 protocol. - *
+ * + *
* Default: false
+ *
* Default: null
+ *
* On machines with multiple network interfaces, this parameter * can be used to select the network interface from which the * connection originates. - *
+ * + *
* Default: null
+ *
* Default: false
since 4.4
+ *
* Default: null
+ *
* Default: true
+ *
* Default: true
+ *
* Default: false
+ *
* Default: 50
+ *
* Default: true
+ *
* Default: null
+ *
* Default: null
+ *
* A timeout value of zero is interpreted as an infinite timeout. * A negative value is interpreted as undefined (system default). - *
+ * + *
* Default: -1
+ *
* A timeout value of zero is interpreted as an infinite timeout. * A negative value is interpreted as undefined (system default). - *
+ * + *
* Default: -1
+ *
SO_TIMEOUT
) in milliseconds,
* which is the timeout for waiting for data or, put differently,
* a maximum period inactivity between two consecutive data packets).
- *
+ * * A timeout value of zero is interpreted as an infinite timeout. * A negative value is interpreted as undefined (system default). - *
+ * + *
* Default: -1
+ *
* Default: true
+ *
* Several setter methods of this builder are mutually exclusive. In case of multiple invocations * of the following methods only the last one will have effect: + *
** Please note that this class treats parameters differently depending on composition * of the request: if the request has a content entity explicitly set with * {@link #setEntity(org.apache.http.HttpEntity)} or it is not an entity enclosing method * (such as POST or PUT), parameters will be added to the query component of the request URI. * Otherwise, parameters will be added as a URL encoded {@link UrlEncodedFormEntity entity}. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java index 71fd28caf..d07048688 100644 --- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java +++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestExpectContinue.java @@ -45,9 +45,10 @@ import org.apache.http.util.Args; /** * RequestExpectContinue is responsible for enabling the 'expect-continue' * handshake by addingExpect
header.
- *
+ * * This interceptor takes into account {@link RequestConfig#isExpectContinueEnabled()} * setting. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java b/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java index 12328d371..227e494a1 100644 --- a/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java +++ b/httpclient/src/main/java/org/apache/http/client/utils/URIBuilder.java @@ -289,9 +289,10 @@ public class URIBuilder { /** * Sets URI query parameters. The parameter name / values are expected to be unescaped * and may contain non ASCII characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove custom query if present. + *
* * @since 4.3 */ @@ -311,9 +312,10 @@ public class URIBuilder { /** * Adds URI query parameters. The parameter name / values are expected to be unescaped * and may contain non ASCII characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove custom query if present. + *
* * @since 4.3 */ @@ -331,9 +333,10 @@ public class URIBuilder { /** * Sets URI query parameters. The parameter name / values are expected to be unescaped * and may contain non ASCII characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove custom query if present. + *
* * @since 4.3 */ @@ -355,9 +358,10 @@ public class URIBuilder { /** * Adds parameter to URI query. The parameter name and value are expected to be unescaped * and may contain non ASCII characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove custom query if present. + *
*/ public URIBuilder addParameter(final String param, final String value) { if (this.queryParams == null) { @@ -373,9 +377,10 @@ public class URIBuilder { /** * Sets parameter of URI query overriding existing value if set. The parameter name and value * are expected to be unescaped and may contain non ASCII characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove custom query if present. + *
*/ public URIBuilder setParameter(final String param, final String value) { if (this.queryParams == null) { @@ -411,9 +416,10 @@ public class URIBuilder { /** * Sets custom URI query. The value is expected to be unescaped and may contain non ASCII * characters. - * + ** Please note query parameters and custom query component are mutually exclusive. This method * will remove query parameters if present. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/conn/EofSensorWatcher.java b/httpclient/src/main/java/org/apache/http/conn/EofSensorWatcher.java index 58e6b426a..b04572ca8 100644 --- a/httpclient/src/main/java/org/apache/http/conn/EofSensorWatcher.java +++ b/httpclient/src/main/java/org/apache/http/conn/EofSensorWatcher.java @@ -75,9 +75,10 @@ public interface EofSensorWatcher { * Indicates that the {@link EofSensorInputStream stream} is aborted. * This method will be called only if EOF was not detected * before aborting. Otherwise, {@link #eofDetected eofDetected} is called. - * + ** This method will also be invoked when an input operation causes an * IOException to be thrown to make sure the input stream gets shut down. + *
* * @param wrapped the underlying stream which has not reached EOF * diff --git a/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java index bbac0b365..1a757816d 100644 --- a/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java +++ b/httpclient/src/main/java/org/apache/http/conn/HttpClientConnectionManager.java @@ -35,15 +35,17 @@ import org.apache.http.protocol.HttpContext; /** * Represents a manager of persistent client connections. - * + ** The purpose of an HTTP connection manager is to serve as a factory for new * HTTP connections, manage persistent connections and synchronize access to * persistent connections making sure that only one thread of execution can * have access to a connection at a time. - *
+ * + ** Implementations of this interface must be thread-safe. Access to shared * data must be synchronized as methods of this interface may be executed * from multiple threads. + *
* * @since 4.3 */ @@ -53,7 +55,7 @@ public interface HttpClientConnectionManager { * Returns a new {@link ConnectionRequest}, from which a * {@link HttpClientConnection} can be obtained or the request can be * aborted. - * + ** Please note that newly allocated connections can be returned * in the closed state. The consumer of that connection is responsible * for fully establishing the route the to the connection target @@ -70,6 +72,7 @@ public interface HttpClientConnectionManager { * org.apache.http.conn.routing.HttpRoute, * org.apache.http.protocol.HttpContext) routeComplete} to mark the route * as fully completed. + *
* * @param route HTTP route of the requested connection. * @param state expected state of the connection ornull
diff --git a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoutePlanner.java b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoutePlanner.java
index 254f1edf3..4b63ffb3c 100644
--- a/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoutePlanner.java
+++ b/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoutePlanner.java
@@ -36,10 +36,11 @@ import org.apache.http.protocol.HttpContext;
* Encapsulates logic to compute a {@link HttpRoute} to a target host.
* Implementations may for example be based on parameters, or on the
* standard Java system properties.
- *
+ * * Implementations of this interface must be thread-safe. Access to shared * data must be synchronized as methods of this interface may be executed * from multiple threads. + *
* * @since 4.0 */ diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java index 4a6677361..b50720651 100644 --- a/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java +++ b/httpclient/src/main/java/org/apache/http/conn/scheme/Scheme.java @@ -36,8 +36,9 @@ import org.apache.http.util.LangUtils; * Encapsulates specifics of a protocol scheme such as "http" or "https". Schemes are identified * by lowercase names. Supported schemes are typically collected in a {@link SchemeRegistry * SchemeRegistry}. - * + ** For example, to configure support for "https://" URLs, you could write code like the following: + *
** Scheme https = new Scheme("https", 443, new MySecureSocketFactory()); * SchemeRegistry registry = new SchemeRegistry(); diff --git a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactory.java index f2f1a7547..196446978 100644 --- a/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactory.java +++ b/httpclient/src/main/java/org/apache/http/conn/scheme/SchemeSocketFactory.java @@ -66,13 +66,14 @@ public interface SchemeSocketFactory { /** * Connects a socket to the target host with the given remote address. - * + ** Please note that {@link org.apache.http.conn.HttpInetSocketAddress} class should * be used in order to pass the target remote address along with the original * {@link org.apache.http.HttpHost} value used to resolve the address. The use of * {@link org.apache.http.conn.HttpInetSocketAddress} can also ensure that no reverse * DNS lookup will be performed if the target remote address was specified * as an IP address. + *
* * @param sock the socket to connect, as obtained from * {@link #createSocket(HttpParams) createSocket}. diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java index 1044e887f..422daf0ec 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java @@ -204,13 +204,15 @@ public abstract class AbstractVerifier implements X509HostnameVerifier { /** * Extracts the array of SubjectAlt DNS names from an X509Certificate. * Returns null if there aren't any. - * + ** Note: Java doesn't appear able to extract international characters * from the SubjectAlts. It can only extract international characters * from the CN field. - *
+ * + ** (Or maybe the version of OpenSSL I'm using to test isn't storing the * international characters correctly in the SubjectAlts?). + *
* * @param cert X509Certificate * @return Array of SubjectALT DNS names stored in the certificate. diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java index 9ba529091..4c4aee9a0 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java @@ -33,13 +33,15 @@ import org.apache.http.annotation.Immutable; /** * The HostnameVerifier that works the same way as Curl and Firefox. - * + ** The hostname must match either the first CN, or any of the subject-alts. * A wildcard can occur in the CN, and in any of the subject-alts. - *
+ * + ** The only difference between BROWSER_COMPATIBLE and STRICT is that a wildcard * (such as "*.foo.com") with BROWSER_COMPATIBLE matches all subdomains, * including "a.b.foo.com". + *
* * @since 4.0 * diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java index 7b11f87a9..d046b16ed 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java @@ -72,11 +72,12 @@ public final class DefaultHostnameVerifier implements HostnameVerifier { * This contains a list of 2nd-level domains that aren't allowed to * have wildcards when combined with country-codes. * For example: [*.co.uk]. - * + ** The [*.co.uk] problem is an interesting one. Should we just hope * that CA's would never foolishly allow such a certificate to happen? * Looks like we're the only implementation guarding against this. * Firefox, Curl, Sun Java 1.4, 5, 6 don't bother with this check. + *
*/ private final static Pattern BAD_COUNTRY_WILDCARD_PATTERN = Pattern.compile( "^[a-z0-9\\-\\*]+\\.(ac|co|com|ed|edu|go|gouv|gov|info|lg|ne|net|or|org)\\.[a-z0-9\\-]{2}$", diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java index db529b1a3..f5eb1cca9 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java @@ -36,18 +36,19 @@ import org.apache.http.annotation.Immutable; * Java 5, Sun Java 6-rc. It's also pretty close to IE6. This * implementation appears to be compliant with RFC 2818 for dealing with * wildcards. - * + ** The hostname must match either the first CN, or any of the subject-alts. * A wildcard can occur in the CN, and in any of the subject-alts. The * one divergence from IE6 is how we only check the first CN. IE6 allows * a match against any of the CNs present. We decided to follow in * Sun Java 1.4's footsteps and only check the first CN. (If you need * to check all the CN's, feel free to write your own implementation!). - *
+ * + ** A wildcard such as "*.foo.com" matches only subdomains in the same * level, for example "a.foo.com". It does not match deeper subdomains * such as "a.b.foo.com". - * + *
* * @since 4.0 * diff --git a/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java b/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java index e84a9f7d1..0c706b259 100644 --- a/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java +++ b/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java @@ -64,10 +64,11 @@ import org.apache.http.util.EncodingUtils; * Currently only qop=auth or no qop is supported. qop=auth-int * is unsupported. If auth and auth-int are provided, auth is * used. - * + ** Since the digest username is included as clear text in the generated * Authentication header, the charset of the username must be compatible * with the HTTP element charset used by the connection. + *
* * @since 4.0 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java index 1f5d0fe3d..c138c35e6 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/AbstractResponseHandler.java @@ -41,11 +41,12 @@ import org.apache.http.util.EntityUtils; * A generic {@link ResponseHandler} that works with the response entity * for successful (2xx) responses. If the response code was >= 300, the response * body is consumed and an {@link HttpResponseException} is thrown. - * + ** If this is used with * {@link org.apache.http.client.HttpClient#execute( * org.apache.http.client.methods.HttpUriRequest, ResponseHandler)}, * HttpClient may handle redirects (3xx responses) internally. + *
* * @since 4.4 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java index 56c984e8f..bd4898c5e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java @@ -50,8 +50,9 @@ import org.apache.http.util.Args; * Default implementation of {@link org.apache.http.client.AuthCache}. This implements * expects {@link org.apache.http.auth.AuthScheme} to be {@link java.io.Serializable} * in order to be cacheable. - * + ** Instances of this class are thread safe as of version 4.4. + *
* * @since 4.1 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java index 338424157..a12df7a8e 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java @@ -39,11 +39,12 @@ import org.apache.http.util.EntityUtils; * A {@link org.apache.http.client.ResponseHandler} that returns the response body as a String * for successful (2xx) responses. If the response code was >= 300, the response * body is consumed and an {@link org.apache.http.client.HttpResponseException} is thrown. - * + ** If this is used with * {@link org.apache.http.client.HttpClient#execute( * org.apache.http.client.methods.HttpUriRequest, org.apache.http.client.ResponseHandler)}, * HttpClient may handle redirects (3xx responses) internally. + *
* * @since 4.0 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java index 29876035b..47249ee5f 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java @@ -62,9 +62,10 @@ import org.apache.http.util.TextUtils; * {@code 307 Temporary Redirect} status codes will result in an automatic redirect of * HEAD and GET methods only. POST and PUT methods will not be automatically redirected * as requiring user confirmation. - * + ** The restriction on automatic redirection of POST methods can be relaxed by using * {@link LaxRedirectStrategy} instead of {@link DefaultRedirectStrategy}. + *
* * @see LaxRedirectStrategy * @since 4.1 diff --git a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java index 134e58085..94cfe3914 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java @@ -122,12 +122,13 @@ import org.apache.http.util.VersionInfo; /** * Builder for {@link CloseableHttpClient} instances. - * + ** When a particular component is not explicitly this class will * use its default implementation. System properties will be taken * into account when configuring the default implementations when * {@link #useSystemProperties()} method is called prior to calling * {@link #build()}. + *
*
* Please note that some settings used by this class can be mutually * exclusive and may not apply when building {@link CloseableHttpClient} * instances. + *
* * @since 4.3 */ @@ -229,10 +231,11 @@ public class HttpClientBuilder { /** * Assigns {@link X509HostnameVerifier} instance. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} and the {@link #setSSLSocketFactory( * org.apache.http.conn.socket.LayeredConnectionSocketFactory)} methods. + *
* * @deprecated (4.4) */ @@ -244,10 +247,11 @@ public class HttpClientBuilder { /** * Assigns {@link javax.net.ssl.HostnameVerifier} instance. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} and the {@link #setSSLSocketFactory( * org.apache.http.conn.socket.LayeredConnectionSocketFactory)} methods. + *
* * @since 4.4 */ @@ -258,11 +262,11 @@ public class HttpClientBuilder { /** * Assigns {@link SSLContext} instance. - * - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} and the {@link #setSSLSocketFactory( * org.apache.http.conn.socket.LayeredConnectionSocketFactory)} methods. + *
*/ public final HttpClientBuilder setSslcontext(final SSLContext sslcontext) { this.sslcontext = sslcontext; @@ -271,9 +275,10 @@ public class HttpClientBuilder { /** * Assigns {@link LayeredConnectionSocketFactory} instance. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
*/ public final HttpClientBuilder setSSLSocketFactory( final LayeredConnectionSocketFactory sslSocketFactory) { @@ -283,9 +288,10 @@ public class HttpClientBuilder { /** * Assigns maximum total connection value. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
*/ public final HttpClientBuilder setMaxConnTotal(final int maxConnTotal) { this.maxConnTotal = maxConnTotal; @@ -294,9 +300,10 @@ public class HttpClientBuilder { /** * Assigns maximum connection per route value. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
*/ public final HttpClientBuilder setMaxConnPerRoute(final int maxConnPerRoute) { this.maxConnPerRoute = maxConnPerRoute; @@ -305,9 +312,10 @@ public class HttpClientBuilder { /** * Assigns default {@link SocketConfig}. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
*/ public final HttpClientBuilder setDefaultSocketConfig(final SocketConfig config) { this.defaultSocketConfig = config; @@ -316,9 +324,10 @@ public class HttpClientBuilder { /** * Assigns default {@link ConnectionConfig}. - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
*/ public final HttpClientBuilder setDefaultConnectionConfig(final ConnectionConfig config) { this.defaultConnectionConfig = config; @@ -327,9 +336,10 @@ public class HttpClientBuilder { /** * Sets maximum time to live for persistent connections - * + ** Please note this value can be overridden by the {@link #setConnectionManager( * org.apache.http.conn.HttpClientConnectionManager)} method. + *
* * @since 4.4 */ @@ -351,10 +361,11 @@ public class HttpClientBuilder { /** * Defines the connection manager is to be shared by multiple * client instances. - * + ** 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. + *
* * @param shared defines whether or not the connection manager can be shared * by multiple clients. @@ -407,9 +418,10 @@ public class HttpClientBuilder { /** * Assigns {@link UserTokenHandler} instance. - * + ** Please note this value can be overridden by the {@link #disableConnectionState()} * method. + *
*/ public final HttpClientBuilder setUserTokenHandler(final UserTokenHandler userTokenHandler) { this.userTokenHandler = userTokenHandler; @@ -435,9 +447,10 @@ public class HttpClientBuilder { /** * Assigns {@code User-Agent} value. - * + ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. + *
*/ public final HttpClientBuilder setUserAgent(final String userAgent) { this.userAgent = userAgent; @@ -446,9 +459,10 @@ public class HttpClientBuilder { /** * Assigns default request header values. - * + ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. + *
*/ public final HttpClientBuilder setDefaultHeaders(final Collection extends Header> defaultHeaders) { this.defaultHeaders = defaultHeaders; @@ -457,9 +471,10 @@ public class HttpClientBuilder { /** * Adds this protocol interceptor to the head of the protocol processing list. - * + ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. + *
*/ public final HttpClientBuilder addInterceptorFirst(final HttpResponseInterceptor itcp) { if (itcp == null) { @@ -474,9 +489,10 @@ public class HttpClientBuilder { /** * Adds this protocol interceptor to the tail of the protocol processing list. - * + ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. + *
*/ public final HttpClientBuilder addInterceptorLast(final HttpResponseInterceptor itcp) { if (itcp == null) { @@ -491,7 +507,7 @@ public class HttpClientBuilder { /** * Adds this protocol interceptor to the head of the protocol processing list. - * + ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ @@ -508,7 +524,7 @@ public class HttpClientBuilder { /** * Adds this protocol interceptor to the tail of the protocol processing list. - *
+ ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ @@ -525,7 +541,7 @@ public class HttpClientBuilder { /** * Disables state (cookie) management. - *
+ ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ @@ -536,7 +552,7 @@ public class HttpClientBuilder { /** * Disables automatic content decompression. - *
+ ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ @@ -547,7 +563,7 @@ public class HttpClientBuilder { /** * Disables authentication scheme caching. - *
+ ** Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ @@ -566,7 +582,7 @@ public class HttpClientBuilder { /** * Assigns {@link HttpRequestRetryHandler} instance. - *
+ ** Please note this value can be overridden by the {@link #disableAutomaticRetries()} * method. */ @@ -585,7 +601,7 @@ public class HttpClientBuilder { /** * Assigns default proxy value. - *
+ ** Please note this value can be overridden by the {@link #setRoutePlanner( * org.apache.http.conn.routing.HttpRoutePlanner)} method. */ @@ -604,9 +620,10 @@ public class HttpClientBuilder { /** * Assigns {@link RedirectStrategy} instance. - *
+ ** Please note this value can be overridden by the {@link #disableRedirectHandling()} * method. + *
` */ public final HttpClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) { this.redirectStrategy = redirectStrategy; @@ -723,8 +740,10 @@ public class HttpClientBuilder { * Produces an instance of {@link ClientExecChain} to be used as a main exec. ** Default implementation produces an instance of {@link MainClientExec} + *
** For internal use. + *
* * @since 4.4 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java index 52788ea52..ae3342bf5 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/StandardHttpRequestRetryHandler.java @@ -38,9 +38,10 @@ import org.apache.http.annotation.Immutable; * {@link org.apache.http.client.HttpRequestRetryHandler} which assumes * that all requested HTTP methods which should be idempotent according * to RFC-2616 are in fact idempotent and can be retried. - * + ** According to RFC-2616 section 9.1.2 the idempotent HTTP methods are: * GET, HEAD, PUT, DELETE, OPTIONS, and TRACE + *
* * @since 4.2 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/client/package-info.java b/httpclient/src/main/java/org/apache/http/impl/client/package-info.java index 0b923eb63..396f8d52b 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/package-info.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/package-info.java @@ -27,8 +27,9 @@ /** * Default HTTP client implementation. - * + ** The usual execution flow can be demonstrated by the code snippet below: + *
** CloseableHttpClient httpclient = HttpClients.createDefault(); * try { diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java index 48c417724..92ca64461 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java @@ -65,15 +65,17 @@ import org.apache.http.util.LangUtils; * A connection manager for a single connection. This connection manager maintains only one active * connection. Even though this class is fully thread-safe it ought to be used by one execution * thread only, as only one thread a time can lease the connection at a time. - * + ** This connection manager will make an effort to reuse the connection for subsequent requests * with the same {@link HttpRoute route}. It will, however, close the existing connection and * open it for the given route, if the route of the persistent connection does not match that * of the connection request. If the connection has been already been allocated * {@link IllegalStateException} is thrown. - *
+ * + ** This connection manager implementation should be used inside an EJB container instead of * {@link PoolingHttpClientConnectionManager}. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java index 83bbbde1b..635979e1a 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java @@ -74,7 +74,7 @@ import org.apache.http.util.Asserts; * basis. A request for a route which already the manager has persistent * connections for available in the pool will be services by leasing * a connection from the pool rather than creating a brand new connection. - * + ** {@code ClientConnectionPoolManager} maintains a maximum limit of connection * on a per route basis and in total. Per default this implementation will * create no more than than 2 concurrent connections per given route @@ -82,13 +82,15 @@ import org.apache.http.util.Asserts; * these limits may prove too constraining, especially if they use HTTP * as a transport protocol for their services. Connection limits, however, * can be adjusted using {@link ConnPoolControl} methods. - * + *
+ ** The handling of stale connections was changed in version 4.4. * Previously, the code would check every connection by default before re-using it. * The code now only checks the connection if the elapsed time since * the last use of the connection exceeds the timeout that has been set. * The default timeout is set to 5000ms - see * {@link #PoolingHttpClientConnectionManager(HttpClientConnectionOperator, HttpConnectionFactory, long, TimeUnit))} + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ClientExecChain.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ClientExecChain.java index 2b03e2939..25cea9a87 100644 --- a/httpclient/src/main/java/org/apache/http/impl/execchain/ClientExecChain.java +++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ClientExecChain.java @@ -40,11 +40,12 @@ import org.apache.http.conn.routing.HttpRoute; * This interface represents an element in the HTTP request execution chain. Each element can * either be a decorator around another element that implements a cross cutting aspect or * a self-contained executor capable of producing a response for the given request. - * + ** Important: please note it is required for decorators that implement post execution aspects * or response post-processing of any sort to release resources associated with the response * by calling {@link CloseableHttpResponse#close()} methods in case of an I/O, protocol or * runtime exception, or in case the response is not propagated to the caller. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java index 98556805c..0f9b75c57 100644 --- a/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ProtocolExec.java @@ -61,10 +61,11 @@ import org.apache.http.util.Args; * Internally this executor relies on a {@link HttpProcessor} to populate * requisite HTTP request headers, process HTTP response headers and update * session state in {@link HttpClientContext}. - * + ** Further responsibilities such as communication with the opposite * endpoint is delegated to the next executor in the request execution * chain. + *
* * @since 4.3 */ diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java index a32488195..6fb6ef39d 100644 --- a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java +++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java @@ -47,10 +47,11 @@ import org.apache.http.util.Args; * Request executor in the request execution chain that is responsible * for making a decision whether a request that received a non-2xx response * from the target server should be re-executed. - * + ** Further responsibilities such as communication with the opposite * endpoint is delegated to the next executor in the request execution * chain. + *
* * @since 4.3 */ diff --git a/httpclient/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java b/httpclient/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java index 4b3156d63..4b9d1b9f2 100644 --- a/httpclient/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java +++ b/httpclient/src/test/java/org/apache/http/conn/ssl/CertificatesToPlayWith.java @@ -29,13 +29,14 @@ package org.apache.http.conn.ssl; /** * Some X509 certificates to test against. - * + ** Note: some of these certificates have Japanese Kanji in the "subjectAlt" * field (UTF8). Not sure how realistic that is since international characters * in DNS names usually get translated into ASCII using "xn--" style DNS * entries. "xn--i8s592g.co.jp" is what FireFox actually uses when trying to * find 花子.co.jp. So would the CN in the certificate contain * "xn--i8s592g.co.jp" in ASCII, or "花子.co.jp" in UTF8? (Both?) + *
* * @since 11-Dec-2006 */