You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/10/04 22:42:48 UTC
svn commit: r1529289 - in /httpcomponents/httpasyncclient/trunk:
httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/
httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/
httpasyncclient/src/main/java/org/apache/h...
Author: olegk
Date: Fri Oct 4 20:42:47 2013
New Revision: 1529289
URL: http://svn.apache.org/r1529289
Log:
Javadoc updates
Added:
httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/util/package-info.java
- copied, changed from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
Modified:
httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpAsyncClient.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/CloseableHttpAsyncClient.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClients.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/HttpAsyncClient.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/HttpAsyncMethods.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyConsumer.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPost.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPut.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/package-info.java
httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpAsyncClient.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpAsyncClient.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingHttpAsyncClient.java Fri Oct 4 20:42:47 2013
@@ -255,7 +255,7 @@ public class CachingHttpAsyncClient impl
final HttpAsyncResponseConsumer<T> responseConsumer,
final HttpContext context,
final FutureCallback<T> callback) {
- this.log.warn("CachingHttpAsyncClient does not caching for streaming HTTP exchanges");
+ this.log.warn("CachingHttpAsyncClient does not support caching for streaming HTTP exchanges");
return this.backend.execute(requestProducer, responseConsumer, context, callback);
}
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/main/java/org/apache/http/impl/client/cache/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * HTTP/1.1 client-side caching.
*/
-package org.apache.http.nio.conn.ssl;
+package org.apache.http.impl.client.cache;
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java-deprecated/org/apache/http/nio/conn/scheme/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * Deprecated
*/
-package org.apache.http.nio.conn.ssl;
+package org.apache.http.nio.conn.scheme;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/CloseableHttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/CloseableHttpAsyncClient.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/CloseableHttpAsyncClient.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/CloseableHttpAsyncClient.java Fri Oct 4 20:42:47 2013
@@ -33,6 +33,7 @@ import java.util.concurrent.Future;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
+import org.apache.http.annotation.ThreadSafe;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URIUtils;
@@ -46,6 +47,12 @@ import org.apache.http.protocol.BasicHtt
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Args;
+/**
+ * Base implementation of {@link HttpAsyncClient} that also implements {@link Closeable}.
+ *
+ * @since 4.0
+ */
+@ThreadSafe
public abstract class CloseableHttpAsyncClient implements HttpAsyncClient, Closeable {
public abstract boolean isRunning();
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClientBuilder.java Fri Oct 4 20:42:47 2013
@@ -106,6 +106,40 @@ import org.apache.http.protocol.RequestU
import org.apache.http.util.TextUtils;
import org.apache.http.util.VersionInfo;
+/**
+ * Builder for {@link CloseableHttpAsyncClient} instances.
+ * <p/>
+ * 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()}.
+ * <ul>
+ * <li>ssl.TrustManagerFactory.algorithm</li>
+ * <li>javax.net.ssl.trustStoreType</li>
+ * <li>javax.net.ssl.trustStore</li>
+ * <li>javax.net.ssl.trustStoreProvider</li>
+ * <li>javax.net.ssl.trustStorePassword</li>
+ * <li>ssl.KeyManagerFactory.algorithm</li>
+ * <li>javax.net.ssl.keyStoreType</li>
+ * <li>javax.net.ssl.keyStore</li>
+ * <li>javax.net.ssl.keyStoreProvider</li>
+ * <li>javax.net.ssl.keyStorePassword</li>
+ * <li>https.protocols</li>
+ * <li>https.cipherSuites</li>
+ * <li>http.proxyHost</li>
+ * <li>http.proxyPort</li>
+ * <li>http.keepAlive</li>
+ * <li>http.maxConnections</li>
+ * <li>http.agent</li>
+ * </ul>
+ * <p/>
+ * Please note that some settings used by this class can be mutually
+ * exclusive and may not apply when building {@link CloseableHttpAsyncClient}
+ * instances.
+ *
+ * @since 4.0
+ */
@NotThreadSafe
public class HttpAsyncClientBuilder {
@@ -165,62 +199,109 @@ public class HttpAsyncClientBuilder {
super();
}
+ /**
+ * Assigns {@link NHttpClientConnectionManager} instance.
+ */
public final HttpAsyncClientBuilder setConnectionManager(
final NHttpClientConnectionManager connManager) {
this.connManager = connManager;
return this;
}
+ /**
+ * Assigns {@link SchemePortResolver} instance.
+ */
public final HttpAsyncClientBuilder setSchemePortResolver(
final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
return this;
}
+ /**
+ * Assigns maximum total connection value.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} method.
+ */
public final HttpAsyncClientBuilder setMaxConnTotal(final int maxConnTotal) {
this.maxConnTotal = maxConnTotal;
return this;
}
+ /**
+ * Assigns maximum connection per route value.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} method.
+ */
public final HttpAsyncClientBuilder setMaxConnPerRoute(final int maxConnPerRoute) {
this.maxConnPerRoute = maxConnPerRoute;
return this;
}
+ /**
+ * Assigns {@link ConnectionReuseStrategy} instance.
+ */
public final HttpAsyncClientBuilder setConnectionReuseStrategy(
final ConnectionReuseStrategy reuseStrategy) {
this.reuseStrategy = reuseStrategy;
return this;
}
+ /**
+ * Assigns {@link ConnectionKeepAliveStrategy} instance.
+ */
public final HttpAsyncClientBuilder setKeepAliveStrategy(
final ConnectionKeepAliveStrategy keepAliveStrategy) {
this.keepAliveStrategy = keepAliveStrategy;
return this;
}
+ /**
+ * Assigns {@link UserTokenHandler} instance.
+ * <p/>
+ * Please note this value can be overridden by the {@link #disableConnectionState()}
+ * method.
+ */
public final HttpAsyncClientBuilder setUserTokenHandler(final UserTokenHandler userTokenHandler) {
this.userTokenHandler = userTokenHandler;
return this;
}
+ /**
+ * Assigns {@link AuthenticationStrategy} instance for proxy
+ * authentication.
+ */
public final HttpAsyncClientBuilder setTargetAuthenticationStrategy(
final AuthenticationStrategy targetAuthStrategy) {
this.targetAuthStrategy = targetAuthStrategy;
return this;
}
+ /**
+ * Assigns {@link AuthenticationStrategy} instance for target
+ * host authentication.
+ */
public final HttpAsyncClientBuilder setProxyAuthenticationStrategy(
final AuthenticationStrategy proxyAuthStrategy) {
this.proxyAuthStrategy = proxyAuthStrategy;
return this;
}
+ /**
+ * Assigns {@link HttpProcessor} instance.
+ */
public final HttpAsyncClientBuilder setHttpProcessor(final HttpProcessor httpprocessor) {
this.httpprocessor = httpprocessor;
return this;
}
+ /**
+ * Adds this protocol interceptor to the head of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder addInterceptorFirst(final HttpResponseInterceptor itcp) {
if (itcp == null) {
return this;
@@ -232,6 +313,12 @@ public class HttpAsyncClientBuilder {
return this;
}
+ /**
+ * Adds this protocol interceptor to the tail of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder addInterceptorLast(final HttpResponseInterceptor itcp) {
if (itcp == null) {
return this;
@@ -243,6 +330,12 @@ public class HttpAsyncClientBuilder {
return this;
}
+ /**
+ * Adds this protocol interceptor to the head of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder addInterceptorFirst(final HttpRequestInterceptor itcp) {
if (itcp == null) {
return this;
@@ -254,6 +347,12 @@ public class HttpAsyncClientBuilder {
return this;
}
+ /**
+ * Adds this protocol interceptor to the tail of the protocol processing list.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder addInterceptorLast(final HttpRequestInterceptor itcp) {
if (itcp == null) {
return this;
@@ -265,99 +364,207 @@ public class HttpAsyncClientBuilder {
return this;
}
+ /**
+ * Assigns {@link HttpRoutePlanner} instance.
+ */
public final HttpAsyncClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
this.routePlanner = routePlanner;
return this;
}
+ /**
+ * Assigns {@link RedirectStrategy} instance.
+ */
public final HttpAsyncClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
this.redirectStrategy = redirectStrategy;
return this;
}
+ /**
+ * Assigns default {@link CookieStore} instance which will be used for
+ * request execution if not explicitly set in the client execution context.
+ */
public final HttpAsyncClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
return this;
}
+ /**
+ * Assigns default {@link CredentialsProvider} instance which will be used
+ * for request execution if not explicitly set in the client execution
+ * context.
+ */
public final HttpAsyncClientBuilder setDefaultCredentialsProvider(
final CredentialsProvider credentialsProvider) {
this.credentialsProvider = credentialsProvider;
return this;
}
+
+ /**
+ * Assigns default {@link org.apache.http.auth.AuthScheme} registry which will
+ * be used for request execution if not explicitly set in the client execution
+ * context.
+ */
public final HttpAsyncClientBuilder setDefaultAuthSchemeRegistry(
final Lookup<AuthSchemeProvider> authSchemeRegistry) {
this.authSchemeRegistry = authSchemeRegistry;
return this;
}
+ /**
+ * Assigns default {@link org.apache.http.cookie.CookieSpec} registry which will
+ * be used for request execution if not explicitly set in the client execution
+ * context.
+ */
public final HttpAsyncClientBuilder setDefaultCookieSpecRegistry(
final Lookup<CookieSpecProvider> cookieSpecRegistry) {
this.cookieSpecRegistry = cookieSpecRegistry;
return this;
}
+ /**
+ * Assigns <tt>User-Agent</tt> value.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder setUserAgent(final String userAgent) {
this.userAgent = userAgent;
return this;
}
+ /**
+ * Assigns default proxy value.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setRoutePlanner(
+ * org.apache.http.conn.routing.HttpRoutePlanner)} method.
+ */
public final HttpAsyncClientBuilder setProxy(final HttpHost proxy) {
this.proxy = proxy;
return this;
}
+ /**
+ * Assigns {@link SchemeIOSessionStrategy} instance.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} method.
+ */
public final HttpAsyncClientBuilder setSSLStrategy(final SchemeIOSessionStrategy strategy) {
this.sslStrategy = strategy;
return this;
}
+ /**
+ * Assigns {@link SSLContext} instance.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} and the {@link #setSSLStrategy(
+ * org.apache.http.nio.conn.SchemeIOSessionStrategy)} methods.
+ */
public final HttpAsyncClientBuilder setSSLContext(final SSLContext sslcontext) {
this.sslcontext = sslcontext;
return this;
}
+ /**
+ * Assigns {@link X509HostnameVerifier} instance.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} and the {@link #setSSLStrategy(
+ * org.apache.http.nio.conn.SchemeIOSessionStrategy)} methods.
+ */
+ public final HttpAsyncClientBuilder setHostnameVerifier(final X509HostnameVerifier hostnameVerifier) {
+ this.hostnameVerifier = hostnameVerifier;
+ return this;
+ }
+
+ /**
+ * Assigns default request header values.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
this.defaultHeaders = defaultHeaders;
return this;
}
+ /**
+ * Assigns default {@link IOReactorConfig}.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} method.
+ */
public final HttpAsyncClientBuilder setDefaultIOReactorConfig(final IOReactorConfig config) {
this.defaultIOReactorConfig = config;
return this;
}
+ /**
+ * Assigns default {@link ConnectionConfig}.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setConnectionManager(
+ * org.apache.http.nio.conn.NHttpClientConnectionManager)} method.
+ */
public final HttpAsyncClientBuilder setDefaultConnectionConfig(final ConnectionConfig config) {
this.defaultConnectionConfig = config;
return this;
}
+ /**
+ * Assigns default {@link RequestConfig} instance which will be used
+ * for request execution if not explicitly set in the client execution
+ * context.
+ */
public final HttpAsyncClientBuilder setDefaultRequestConfig(final RequestConfig config) {
this.defaultRequestConfig = config;
return this;
}
+ /**
+ * Assigns {@link ThreadFactory} instance.
+ */
public final HttpAsyncClientBuilder setThreadFactory(final ThreadFactory threadFactory) {
this.threadFactory = threadFactory;
return this;
}
+ /**
+ * Disables connection state tracking.
+ */
public final HttpAsyncClientBuilder disableConnectionState() {
connectionStateDisabled = true;
return this;
}
+ /**
+ * Disables state (cookie) management.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder disableCookieManagement() {
cookieManagementDisabled = true;
return this;
}
+ /**
+ * Disables authentication scheme caching.
+ * <p/>
+ * Please note this value can be overridden by the {@link #setHttpProcessor(
+ * org.apache.http.protocol.HttpProcessor)} method.
+ */
public final HttpAsyncClientBuilder disableAuthCaching() {
authCachingDisabled = true;
return this;
}
+ /**
+ * Use system properties when creating and configuring default
+ * implementations.
+ */
public final HttpAsyncClientBuilder useSystemProperties() {
systemProperties = true;
return this;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClients.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClients.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClients.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/HttpAsyncClients.java Fri Oct 4 20:42:47 2013
@@ -34,6 +34,11 @@ import org.apache.http.nio.conn.NHttpCli
import org.apache.http.nio.reactor.ConnectingIOReactor;
import org.apache.http.util.Args;
+/**
+ * Factory methods for {@link CloseableHttpAsyncClient} instances.
+ *
+ * @since 4.0
+ */
@Immutable
public class HttpAsyncClients {
@@ -41,29 +46,53 @@ public class HttpAsyncClients {
super();
}
+ /**
+ * Creates builder object for construction of custom
+ * {@link CloseableHttpAsyncClient} instances.
+ */
public static HttpAsyncClientBuilder custom() {
return HttpAsyncClientBuilder.create();
}
+ /**
+ * Creates {@link CloseableHttpAsyncClient} instance with default
+ * configuration.
+ */
public static CloseableHttpAsyncClient createDefault() {
return HttpAsyncClientBuilder.create().build();
}
+ /**
+ * Creates {@link CloseableHttpAsyncClient} instance with default
+ * configuration based on ssytem properties.
+ */
public static CloseableHttpAsyncClient createSystem() {
return HttpAsyncClientBuilder.create().useSystemProperties().build();
}
+ /**
+ * Creates {@link CloseableHttpAsyncClient} instance that implements
+ * the most basic HTTP protocol support.
+ */
public static CloseableHttpAsyncClient createMinimal() {
return new MinimalHttpAsyncClient(
new PoolingNHttpClientConnectionManager(IOReactorUtils.create(IOReactorConfig.DEFAULT)));
}
+ /**
+ * Creates {@link CloseableHttpAsyncClient} instance that implements
+ * the most basic HTTP protocol support.
+ */
public static CloseableHttpAsyncClient createMinimal(final ConnectingIOReactor ioreactor) {
Args.notNull(ioreactor, "I/O reactor");
return new MinimalHttpAsyncClient(
new PoolingNHttpClientConnectionManager(ioreactor));
}
+ /**
+ * Creates {@link CloseableHttpAsyncClient} instance that implements
+ * the most basic HTTP protocol support.
+ */
public static CloseableHttpAsyncClient createMinimal(final NHttpClientConnectionManager connManager) {
Args.notNull(connManager, "Connection manager");
return new MinimalHttpAsyncClient(connManager);
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/MinimalClientExchangeHandlerImpl.java Fri Oct 4 20:42:47 2013
@@ -59,7 +59,7 @@ import org.apache.http.nio.protocol.Http
import org.apache.http.protocol.HttpCoreContext;
import org.apache.http.protocol.HttpProcessor;
-public class MinimalClientExchangeHandlerImpl<T>
+class MinimalClientExchangeHandlerImpl<T>
implements HttpAsyncClientExchangeHandler, Cancellable {
private static final AtomicLong COUNTER = new AtomicLong(1);
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,7 +26,21 @@
*/
/**
- * Default implementations of client connection management
- * functions.
+ * Default asynchronous HTTP client implementation.
+ * <p/>
+ * The usual execution flow can be demonstrated by the code snippet below:
+ * <pre>
+ * CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
+ * try {
+ * httpclient.start();
+ * HttpGet request = new HttpGet("http://www.apache.org/");
+ * Future<HttpResponse> future = httpclient.execute(request, null);
+ * HttpResponse response = future.get();
+ * System.out.println(response.getStatusLine());
+ * // Do something useful with the response body
+ * } finally {
+ * httpclient.close();
+ * }
+ * </pre>
*/
-package org.apache.http.impl.nio.conn;
+package org.apache.http.impl.nio.client;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/PoolingNHttpClientConnectionManager.java Fri Oct 4 20:42:47 2013
@@ -38,6 +38,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
+import org.apache.http.annotation.ThreadSafe;
import org.apache.http.concurrent.BasicFuture;
import org.apache.http.concurrent.FutureCallback;
import org.apache.http.config.ConnectionConfig;
@@ -68,6 +69,25 @@ import org.apache.http.protocol.HttpCont
import org.apache.http.util.Args;
import org.apache.http.util.Asserts;
+/**
+ * <tt>PoolingNHttpClientConnectionManager</tt> maintains a pool of
+ * {@link NHttpClientConnection}s and is able to service connection requests
+ * from multiple execution threads. Connections are pooled on a per route
+ * 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.
+ * <p/>
+ * <tt>PoolingNHttpClientConnectionManager</tt> 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 and no more 20 connections in total. For many real-world
+ * applications 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.
+ *
+ * @since 4.0
+ */
+@ThreadSafe
public class PoolingNHttpClientConnectionManager
implements NHttpClientConnectionManager, ConnPoolControl<HttpRoute> {
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,7 +26,7 @@
*/
/**
- * Default implementations of client connection management
- * functions.
+ * Default implementations of asynchronous client connection
+ * management functions.
*/
package org.apache.http.impl.nio.conn;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/HttpAsyncClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/HttpAsyncClient.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/HttpAsyncClient.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/HttpAsyncClient.java Fri Oct 4 20:42:47 2013
@@ -37,31 +37,112 @@ import org.apache.http.nio.protocol.Http
import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
import org.apache.http.protocol.HttpContext;
+/**
+ * This interface represents only the most basic contract for HTTP request
+ * execution. It imposes no restrictions or particular details on the request
+ * execution process and leaves the specifics of state management,
+ * authentication and redirect handling up to individual implementations.
+ *
+ * @since 4.0
+ */
public interface HttpAsyncClient {
+ /**
+ * Initiates asynchronous HTTP request execution using the given context.
+ * <p/>
+ * The request producer passed to this method will be used to generate
+ * a request message and stream out its content without buffering it
+ * in memory. The response consumer passed to this method will be used
+ * to process a response message without buffering its content in memory.
+ *
+ * @param <T> the result type of request execution.
+ * @param requestProducer request producer callback.
+ * @param responseConsumer response consumer callaback.
+ * @param context HTTP context
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
<T> Future<T> execute(
HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
HttpContext context,
FutureCallback<T> callback);
+ /**
+ * Initiates asynchronous HTTP request execution using the default
+ * context.
+ * <p/>
+ * The request producer passed to this method will be used to generate
+ * a request message and stream out its content without buffering it
+ * in memory. The response consumer passed to this method will be used
+ * to process a response message without buffering its content in memory.
+ *
+ * @param <T> the result type of request execution.
+ * @param requestProducer request producer callback.
+ * @param responseConsumer response consumer callaback.
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
<T> Future<T> execute(
HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
FutureCallback<T> callback);
+ /**
+ * Initiates asynchronous HTTP request execution against the given target
+ * using the given context.
+ *
+ * @param target the target host for the request.
+ * Implementations may accept <code>null</code>
+ * if they can still determine a route, for example
+ * to a default target or by inspecting the request.
+ * @param request the request to execute
+ * @param context the context to use for the execution, or
+ * <code>null</code> to use the default context
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
Future<HttpResponse> execute(
HttpHost target, HttpRequest request, HttpContext context,
FutureCallback<HttpResponse> callback);
+ /**
+ * Initiates asynchronous HTTP request execution against the given target
+ * using the default context.
+ *
+ * @param target the target host for the request.
+ * Implementations may accept <code>null</code>
+ * if they can still determine a route, for example
+ * to a default target or by inspecting the request.
+ * @param request the request to execute
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
Future<HttpResponse> execute(
HttpHost target, HttpRequest request,
FutureCallback<HttpResponse> callback);
+ /**
+ * Initiates asynchronous HTTP request execution using the given
+ * context.
+ *
+ * @param request the request to execute
+ * @param context HTTP context
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
Future<HttpResponse> execute(
HttpUriRequest request, HttpContext context,
FutureCallback<HttpResponse> callback);
+ /**
+ * Initiates asynchronous HTTP request execution using the default
+ * context.
+ *
+ * @param request the request to execute
+ * @param callback future callback.
+ * @return future representing pending completion of the operation.
+ */
Future<HttpResponse> execute(
HttpUriRequest request,
FutureCallback<HttpResponse> callback);
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncByteConsumer.java Fri Oct 4 20:42:47 2013
@@ -36,6 +36,13 @@ import org.apache.http.nio.IOControl;
import org.apache.http.nio.protocol.AbstractAsyncResponseConsumer;
import org.apache.http.util.Asserts;
+/**
+ * {@link org.apache.http.nio.protocol.HttpAsyncResponseConsumer} implementation that
+ * provides convenience methods for processing of binary content entities enclosed
+ * in an HTTP response.
+ *
+ * @since 4.0
+ */
public abstract class AsyncByteConsumer<T> extends AbstractAsyncResponseConsumer<T> {
private final int bufSize;
@@ -50,6 +57,15 @@ public abstract class AsyncByteConsumer<
this(8 * 1024);
}
+ /**
+ * Invoked to process a {@link ByteBuffer chunk} of content.
+ * The {@link IOControl} interface can be used to suspend input events
+ * if the consumer is temporarily unable to consume more content.
+ *
+ * @param buf chunk of content.
+ * @param ioctrl I/O control of the underlying connection.
+ * @throws IOException in case of an I/O error
+ */
protected abstract void onByteReceived(
ByteBuffer buf, IOControl ioctrl) throws IOException;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/AsyncCharConsumer.java Fri Oct 4 20:42:47 2013
@@ -41,6 +41,13 @@ import org.apache.http.nio.protocol.Abst
import org.apache.http.protocol.HTTP;
import org.apache.http.util.Asserts;
+/**
+ * {@link org.apache.http.nio.protocol.HttpAsyncResponseConsumer} implementation that
+ * provides convenience methods for processing of textual content entities enclosed
+ * in an HTTP response.
+ *
+ * @since 4.0
+ */
public abstract class AsyncCharConsumer<T> extends AbstractAsyncResponseConsumer<T> {
private final int bufSize;
@@ -58,6 +65,15 @@ public abstract class AsyncCharConsumer<
this(8 * 1024);
}
+ /**
+ * Invoked to process a {@link CharBuffer chunk} of content.
+ * The {@link IOControl} interface can be used to suspend input events
+ * if the consumer is temporarily unable to consume more content.
+ *
+ * @param buf chunk of content.
+ * @param ioctrl I/O control of the underlying connection.
+ * @throws IOException in case of an I/O error
+ */
protected abstract void onCharReceived(
CharBuffer buf, IOControl ioctrl) throws IOException;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/HttpAsyncMethods.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/HttpAsyncMethods.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/HttpAsyncMethods.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/HttpAsyncMethods.java Fri Oct 4 20:42:47 2013
@@ -53,60 +53,146 @@ import org.apache.http.nio.protocol.Http
import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
import org.apache.http.util.Args;
+/**
+ * Factory methods for asynchronous request producers and response consumers.
+ *
+ * @since 4.0
+ */
public final class HttpAsyncMethods {
+ /**
+ * Creates asynchronous request generator for the given request message.
+ *
+ * @param target request target.
+ * @param request request message.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer create(final HttpHost target, final HttpRequest request) {
Args.notNull(target, "HTTP host");
Args.notNull(request, "HTTP request");
return new RequestProducerImpl(target, request);
}
+ /**
+ * Creates asynchronous request generator for the given request message.
+ *
+ * @param request request message.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer create(final HttpUriRequest request) {
Args.notNull(request, "HTTP request");
final HttpHost target = URIUtils.extractHost(request.getURI());
return new RequestProducerImpl(target, request);
}
+ /**
+ * Creates asynchronous <code>GET<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createGet(final URI requestURI) {
return create(new HttpGet(requestURI));
}
+ /**
+ * Creates asynchronous <code>GET<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createGet(final String requestURI) {
return create(new HttpGet(URI.create(requestURI)));
}
+ /**
+ * Creates asynchronous <code>HEAD<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createHead(final URI requestURI) {
return create(new HttpGet(requestURI));
}
+ /**
+ * Creates asynchronous <code>HEAD<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createHead(final String requestURI) {
return create(new HttpGet(URI.create(requestURI)));
}
+ /**
+ * Creates asynchronous <code>DELETE<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createDelete(final URI requestURI) {
return create(new HttpDelete(requestURI));
}
+ /**
+ * Creates asynchronous <code>DELETE<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createDelete(final String requestURI) {
return create(new HttpDelete(URI.create(requestURI)));
}
+ /**
+ * Creates asynchronous <code>OPTIONS<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createOptions(final URI requestURI) {
return create(new HttpOptions(requestURI));
}
+ /**
+ * Creates asynchronous <code>OPTIONS<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createOptions(final String requestURI) {
return create(new HttpOptions(URI.create(requestURI)));
}
+ /**
+ * Creates asynchronous <code>TRACE<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createTrace(final URI requestURI) {
return create(new HttpTrace(requestURI));
}
+ /**
+ * Creates asynchronous <code>TRACE<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createTrace(final String requestURI) {
return create(new HttpTrace(URI.create(requestURI)));
}
+ /**
+ * Creates asynchronous <code>POST<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPost(
final URI requestURI,
final String content,
@@ -118,6 +204,14 @@ public final class HttpAsyncMethods {
return new RequestProducerImpl(target, httppost, entity);
}
+ /**
+ * Creates asynchronous <code>POST<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPost(
final String requestURI,
final String content,
@@ -125,6 +219,14 @@ public final class HttpAsyncMethods {
return createPost(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates asynchronous <code>POST<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPost(
final URI requestURI,
final byte[] content,
@@ -135,6 +237,14 @@ public final class HttpAsyncMethods {
return new RequestProducerImpl(target, httppost, entity);
}
+ /**
+ * Creates asynchronous <code>POST<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPost(
final String requestURI,
final byte[] content,
@@ -142,6 +252,14 @@ public final class HttpAsyncMethods {
return createPost(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates asynchronous <code>PUT<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPut(
final URI requestURI,
final String content,
@@ -153,6 +271,14 @@ public final class HttpAsyncMethods {
return new RequestProducerImpl(target, httpput, entity);
}
+ /**
+ * Creates asynchronous <code>PUT<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPut(
final String requestURI,
final String content,
@@ -160,6 +286,14 @@ public final class HttpAsyncMethods {
return createPut(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates asynchronous <code>PUT<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPut(
final URI requestURI,
final byte[] content,
@@ -170,6 +304,14 @@ public final class HttpAsyncMethods {
return new RequestProducerImpl(target, httpput, entity);
}
+ /**
+ * Creates asynchronous <code>PUT<code/> request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createPut(
final String requestURI,
final byte[] content,
@@ -177,6 +319,14 @@ public final class HttpAsyncMethods {
return createPut(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates asynchronous zero-copy <code>POST<code/>request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createZeroCopyPost(
final URI requestURI,
final File content,
@@ -184,6 +334,14 @@ public final class HttpAsyncMethods {
return new ZeroCopyPost(requestURI, content, contentType);
}
+ /**
+ * Creates asynchronous zero-copy <code>POST<code/>request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createZeroCopyPost(
final String requestURI,
final File content,
@@ -191,6 +349,14 @@ public final class HttpAsyncMethods {
return new ZeroCopyPost(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates asynchronous zero-copy <code>PUT<code/>request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createZeroCopyPut(
final URI requestURI,
final File content,
@@ -198,6 +364,14 @@ public final class HttpAsyncMethods {
return new ZeroCopyPut(requestURI, content, contentType);
}
+ /**
+ * Creates asynchronous zero-copy <code>PUT<code/>request generator.
+ *
+ * @param requestURI request URI.
+ * @param content request content.
+ * @param contentType request contentType.
+ * @return asynchronous request generator
+ */
public static HttpAsyncRequestProducer createZeroCopyPut(
final String requestURI,
final File content,
@@ -205,10 +379,19 @@ public final class HttpAsyncMethods {
return new ZeroCopyPut(URI.create(requestURI), content, contentType);
}
+ /**
+ * Creates basic response consumer that will buffer response content in memory.
+ * @return asynchronous response consumer.
+ */
public static HttpAsyncResponseConsumer<HttpResponse> createConsumer() {
return new BasicAsyncResponseConsumer();
}
+ /**
+ * Creates zero-copy response consumer that will stream response content
+ * directly to the given file.
+ * @return asynchronous response consumer.
+ */
public static HttpAsyncResponseConsumer<HttpResponse> createZeroCopyConsumer(
final File file) throws FileNotFoundException {
return new ZeroCopyConsumer<HttpResponse>(file) {
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyConsumer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyConsumer.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyConsumer.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyConsumer.java Fri Oct 4 20:42:47 2013
@@ -45,6 +45,15 @@ import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Asserts;
+/**
+ * {@link org.apache.http.nio.protocol.HttpAsyncResponseConsumer} implementation that
+ * streams content entity enclosed in an HTTP response directly into a file
+ * without an intermediate in-memory buffer.
+ * <p/>
+ * This consumer can be useful for file downloads.
+ *
+ * @since 4.0
+ */
public abstract class ZeroCopyConsumer<T> extends AbstractAsyncResponseConsumer<T> {
private final File file;
@@ -97,6 +106,14 @@ public abstract class ZeroCopyConsumer<T
}
}
+ /**
+ * Invoked to process received file.
+ *
+ * @param response original response head.
+ * @param file file containing response content.
+ * @param contentType the cotnent type.
+ * @return result of the response processing
+ */
protected abstract T process(
HttpResponse response, File file, ContentType contentType) throws Exception;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPost.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPost.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPost.java Fri Oct 4 20:42:47 2013
@@ -35,6 +35,14 @@ import org.apache.http.HttpEntityEnclosi
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
+/**
+ * {@link org.apache.http.nio.protocol.HttpAsyncRequestProducer} implementation
+ * that generates an HTTP <code>POST</code> request enclosing content of a file.
+ * The request content will be streamed out directly from the underlying file
+ * without an intermediate in-memory buffer.
+ *
+ * @since 4.0
+ */
public class ZeroCopyPost extends BaseZeroCopyRequestProducer {
public ZeroCopyPost(
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPut.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPut.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPut.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/ZeroCopyPut.java Fri Oct 4 20:42:47 2013
@@ -35,6 +35,14 @@ import org.apache.http.HttpEntityEnclosi
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.ContentType;
+/**
+ * {@link org.apache.http.nio.protocol.HttpAsyncRequestProducer} implementation
+ * that generates an HTTP <code>PUT</code> request enclosing content of a file.
+ * The request content will be streamed out directly from the underlying file
+ * without an intermediate in-memory buffer.
+ *
+ * @since 4.0
+ */
public class ZeroCopyPut extends BaseZeroCopyRequestProducer {
public ZeroCopyPut(
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/methods/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * Asynchronous HTTP method implementations.
*/
-package org.apache.http.nio.conn.ssl;
+package org.apache.http.nio.client.methods;
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * Asynchronous HTTP client communication APIs.
*/
-package org.apache.http.nio.conn.ssl;
+package org.apache.http.nio.client;
Copied: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/util/package-info.java (from r1528613, httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/util/package-info.java?p2=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/util/package-info.java&p1=httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java&r1=1528613&r2=1529289&rev=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/client/util/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * Asynchronous client utility classes.
*/
-package org.apache.http.nio.conn.ssl;
+package org.apache.http.nio.client.util;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/package-info.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/package-info.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client connection management APIs.
+ * Asynchronous client connection management APIs.
*/
package org.apache.http.nio.conn;
Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java?rev=1529289&r1=1529288&r2=1529289&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/nio/conn/ssl/package-info.java Fri Oct 4 20:42:47 2013
@@ -26,6 +26,6 @@
*/
/**
- * Client TLS/SSL support.
+ * Asynchronous client TLS/SSL support.
*/
package org.apache.http.nio.conn.ssl;