Skip to content

Commits on Source 54

......@@ -18,3 +18,4 @@ test-output
/META-INF/MANIFEST.MF
work
atlassian-ide-plugin.xml
/nb-configuration.xml
\ No newline at end of file
async-http-client (1.8.12-1) UNRELEASED; urgency=medium
async-http-client (1.9.40-1) UNRELEASED; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
- Removed the patches (fixed upstream)
- Disabled the Grizzly provider (missing dependency)
- Ignored the new test dependencies
- Ignore the maven-scm extensions
- No longer depend on libcommons-httpclient-java
- No longer build depend on the Maven shade plugin
* Suggest the optional dependencies instead of recommending them
* Removed the -doc package
* Standards-Version updated to 4.2.1
* Switch to debhelper level 11
* Use salsa.debian.org Vcs-* URLs
......
......@@ -6,12 +6,7 @@ Uploaders: Emmanuel Bourg <ebourg@apache.org>
Build-Depends:
debhelper (>= 11~),
default-jdk,
default-jdk-doc,
libcommons-httpclient-java,
libcommons-logging-java-doc,
libmaven-bundle-plugin-java,
libmaven-javadoc-plugin-java,
libmaven-shade-plugin-java,
libnetty-3.9-java,
libslf4j-java,
maven-debian-helper (>= 2.2)
......@@ -23,20 +18,7 @@ Homepage: https://github.com/AsyncHttpClient/async-http-client
Package: libasync-http-client-java
Architecture: all
Depends: ${maven:Depends}, ${misc:Depends}
Recommends: ${maven:OptionalDepends}
Suggests: libasync-http-client-java-doc
Suggests: ${maven:OptionalDepends}
Description: Java Asynchronous HTTP Client
Async HTTP Client library purpose is to allow Java applications to easily
execute HTTP requests and asynchronously process the HTTP responses.
Package: libasync-http-client-java-doc
Architecture: all
Section: doc
Depends: ${maven:DocDepends}, ${misc:Depends}
Recommends: ${maven:DocOptionalDepends}
Suggests: libasync-http-client-java
Description: Documentation for Java Asynchronous HTTP Client
Async HTTP Client library purpose is to allow Java applications to easily
execute HTTP requests and asynchronously process the HTTP responses.
.
This package contains the API documentation of libasync-http-client-java.
Document: libasync-http-client-java
Title: API Javadoc for Asynchronous HTTP Client
Author: Asynchronous HTTP Client developers
Abstract: This is the API Javadoc provided for the
libasync-http-client-java library.
Section: Programming
Format: HTML
Index: /usr/share/doc/libasync-http-client-java/api/index.html
Files: /usr/share/doc/libasync-http-client-java/api/*
target/apidocs/* usr/share/doc/libasync-http-client-java/api
......@@ -4,6 +4,6 @@
maven.test.skip=true
compiler.exclude=com/ning/http/client/providers/grizzly/*.java
test.compiler.exclude=com/ning/http/client/async/grizzly/*.java
compiler.exclude=com/ning/http/client/providers/grizzly/**
test.compiler.exclude=com/ning/http/client/async/grizzly/**
javadoc.package.exclude=com.ning.http.client.providers.grizzly
......@@ -17,6 +17,4 @@
# junit junit jar s/3\\..*/3.x/
com.ning async-http-client jar s/.*/debian/ * *
commons-httpclient commons-httpclient jar s/3\..*/3.x/ * *
commons-logging s/commons-logging-api/commons-logging/ * s/.*/debian/ * *
s/org.jboss.netty/io.netty/ netty * s/.*/debian/ * *
Description: Fix a compilation error with Java 8. This has been fixed upstream
in the version 1.9 by renaming the replace() method to replaceWith().
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
Bug-Debian: http://bugs.debian.org/773372
--- a/src/main/java/com/ning/http/client/FluentStringsMap.java
+++ b/src/main/java/com/ning/http/client/FluentStringsMap.java
@@ -139,7 +139,7 @@
* @return This object
*/
public FluentStringsMap replace(final String key, final String... values) {
- return replace(key, Arrays.asList(values));
+ return replace(key, (Collection<String>) Arrays.asList(values));
}
/**
--- a/src/main/java/com/ning/http/client/FluentCaseInsensitiveStringsMap.java
+++ b/src/main/java/com/ning/http/client/FluentCaseInsensitiveStringsMap.java
@@ -184,7 +184,7 @@
* @return This object
*/
public FluentCaseInsensitiveStringsMap replace(final String key, final String... values) {
- return replace(key, Arrays.asList(values));
+ return replace(key, (Collection<String>) Arrays.asList(values));
}
/**
Description: Remove the code disabling the SSL certificate validation
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/src/main/java/com/ning/http/util/SslUtils.java
+++ b/src/main/java/com/ning/http/util/SslUtils.java
@@ -54,12 +54,7 @@
throws GeneralSecurityException, IOException {
if (context == null) {
SSLConfig config = new SSLConfig();
- if (config.keyStoreLocation == null
- || config.trustStoreLocation == null) {
- context = getLooseSSLContext();
- } else {
- context = getStrictSSLContext(config);
- }
+ context = getStrictSSLContext(config);
}
return context;
}
@@ -99,29 +94,6 @@
return context;
}
- static SSLContext getLooseSSLContext()
- throws GeneralSecurityException {
- SSLContext sslContext = SSLContext.getInstance("TLS");
- sslContext.init(null, new TrustManager[]{LooseTrustManager.INSTANCE}, new SecureRandom());
- return sslContext;
- }
-
- static class LooseTrustManager
- implements X509TrustManager {
-
- public static final LooseTrustManager INSTANCE = new LooseTrustManager();
-
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return new java.security.cert.X509Certificate[0];
- }
-
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
-
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
- }
- }
-
private final static class SSLConfig {
public String keyStoreLocation;
--- a/src/main/java/com/ning/http/client/providers/apache/ApacheAsyncHttpProvider.java
+++ b/src/main/java/com/ning/http/client/providers/apache/ApacheAsyncHttpProvider.java
@@ -136,24 +136,6 @@
private final HttpClientParams params;
private final ScheduledExecutorService reaper;
- static {
- final SocketFactory factory = new TrustingSSLSocketFactory();
- Protocol.registerProtocol("https", new Protocol("https", new ProtocolSocketFactory() {
- public Socket createSocket(String string, int i, InetAddress inetAddress, int i1) throws IOException {
- return factory.createSocket(string, i, inetAddress, i1);
- }
-
- public Socket createSocket(String string, int i, InetAddress inetAddress, int i1, HttpConnectionParams httpConnectionParams)
- throws IOException {
- return factory.createSocket(string, i, inetAddress, i1);
- }
-
- public Socket createSocket(String string, int i) throws IOException {
- return factory.createSocket(string, i);
- }
- }, 443));
- }
-
public ApacheAsyncHttpProvider(AsyncHttpClientConfig config) {
this.config = config;
connectionManager = new MultiThreadedHttpConnectionManager();
@@ -752,72 +734,6 @@
}
}
- private static class TrustingSSLSocketFactory extends SSLSocketFactory {
- private SSLSocketFactory delegate;
-
- private TrustingSSLSocketFactory() {
- try {
- SSLContext sslcontext = SSLContext.getInstance("SSL");
-
- sslcontext.init(null, new TrustManager[]{new TrustEveryoneTrustManager()}, new SecureRandom());
- delegate = sslcontext.getSocketFactory();
- } catch (KeyManagementException e) {
- throw new IllegalStateException();
- } catch (NoSuchAlgorithmException e) {
- throw new IllegalStateException();
- }
- }
-
- @Override
- public Socket createSocket(String s, int i) throws IOException, UnknownHostException {
- return delegate.createSocket(s, i);
- }
-
- @Override
- public Socket createSocket(String s, int i, InetAddress inetAddress, int i1) throws IOException, UnknownHostException {
- return delegate.createSocket(s, i, inetAddress, i1);
- }
-
- @Override
- public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
- return delegate.createSocket(inetAddress, i);
- }
-
- @Override
- public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1) throws IOException {
- return delegate.createSocket(inetAddress, i, inetAddress1, i1);
- }
-
- @Override
- public String[] getDefaultCipherSuites() {
- return delegate.getDefaultCipherSuites();
- }
-
- @Override
- public String[] getSupportedCipherSuites() {
- return delegate.getSupportedCipherSuites();
- }
-
- @Override
- public Socket createSocket(Socket socket, String s, int i, boolean b) throws IOException {
- return delegate.createSocket(socket, s, i, b);
- }
- }
-
- private static class TrustEveryoneTrustManager implements X509TrustManager {
- public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- // do nothing
- }
-
- public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- // do nothing
- }
-
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
- }
-
private final class ReaperFuture implements Future, Runnable {
private Future scheduledFuture;
private ApacheResponseFuture<?> apacheResponseFuture;
Description: Disables Grizzly support (not in Debian)
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/pom.xml
+++ b/pom.xml
@@ -235,6 +235,12 @@
<version>2.3.2</version>
<configuration>
<maxmem>1024m</maxmem>
+ <excludes>
+ <exclude>${compiler.exclude}</exclude>
+ </excludes>
+ <testExcludes>
+ <testExclude>${test.compiler.exclude}</testExclude>
+ </testExcludes>
</configuration>
</plugin>
<plugin>
@@ -386,6 +392,7 @@
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
+ <excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
</configuration>
<executions>
<execution>
01-java8-compatibility.patch
02-CVE-2013-7397.patch
03-disable-grizzly-support.patch
......@@ -9,7 +9,7 @@
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<name>Asynchronous Http Client</name>
<version>1.8.12</version>
<version>1.9.40</version>
<packaging>jar</packaging>
<description>
Async Http Client library purpose is to allow Java applications to easily execute HTTP requests and
......@@ -81,13 +81,32 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.9.2.Final</version>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>connection-pool</artifactId>
<version>${grizzly.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-websockets</artifactId>
<version>${grizzly.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>${grizzly.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<version>1.7.12</version>
</dependency>
<dependency>
......@@ -101,21 +120,26 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<version>1.1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
<version>1.2.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<version>6.8.8</version>
<scope>test</scope>
<classifier>jdk15</classifier>
<exclusions>
<exclusion>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
......@@ -178,26 +202,6 @@
<version>1.2.2</version>
<scope>test</scope>
</dependency>
<!-- Optional Apache Http Client -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<extensions>
......@@ -230,15 +234,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${source.property}</source>
<target>${target.property}</target>
<maxmem>1024m</maxmem>
<excludes>
<exclude>${compiler.exclude}</exclude>
</excludes>
<testExcludes>
<testExclude>${test.compiler.exclude}</testExclude>
</testExcludes>
</configuration>
</plugin>
<plugin>
......@@ -250,20 +246,28 @@
<redirectTestOutputToFile>${surefire.redirectTestOutputToFile}</redirectTestOutputToFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.6</version>
<version>1.14</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java15</artifactId>
<artifactId>java17</artifactId>
<version>1.0</version>
</signature>
<ignores>
<ignore>sun.misc.Unsafe</ignore>
</ignores>
</configuration>
<executions>
<execution>
<id>check-java-1.5-compat</id>
<id>check-java-1.7-compat</id>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
......@@ -319,7 +323,7 @@
<version>2.0.9</version>
</requireMavenVersion>
<requireJavaVersion>
<version>1.5</version>
<version>${maven.compiler.source}</version>
</requireJavaVersion>
</rules>
</configuration>
......@@ -376,13 +380,12 @@
<version>2.8.1</version>
<configuration>
<aggregate>true</aggregate>
<source>1.6</source>
<source>${maven.compiler.source}</source>
<encoding>UTF-8</encoding>
<maxmemory>1g</maxmemory>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
<excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
</configuration>
<executions>
<execution>
......@@ -394,38 +397,6 @@
</execution>
</executions>
</plugin>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-shade-plugin</artifactId> -->
<!-- <version>1.2.1</version> -->
<!-- <executions> -->
<!-- <execution> -->
<!-- <phase>package</phase> -->
<!-- <goals> -->
<!-- <goal>shade</goal> -->
<!-- </goals> -->
<!-- <configuration> -->
<!-- <shadedArtifactAttached>true</shadedArtifactAttached> -->
<!-- <shadedClassifierName>shaded</shadedClassifierName> -->
<!-- <artifactSet> -->
<!-- <excludes> -->
<!-- <exclude>commons-codec:commons-codec</exclude> -->
<!-- <exclude>commons-lang:commons-lang</exclude> -->
<!-- <exclude>commons-logging:commons-logging</exclude> -->
<!-- <exclude>junit:junit</exclude> -->
<!-- <exclude>log4j:log4j</exclude> -->
<!-- <exclude>commons-httpclient:commons-httpclient</exclude> -->
<!-- </excludes> -->
<!-- </artifactSet> -->
<!-- <transformers> -->
<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> -->
<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" /> -->
<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" /> -->
<!-- </transformers> -->
<!-- </configuration> -->
<!-- </execution> -->
<!-- </executions> -->
<!-- </plugin> -->
</plugins>
</build>
<reporting>
......@@ -436,13 +407,12 @@
<version>2.8.1</version>
<configuration>
<aggregate>true</aggregate>
<source>1.6</source>
<source>${maven.compiler.source}</source>
<encoding>UTF-8</encoding>
<maxmemory>1g</maxmemory>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
<link>http://java.sun.com/javase/7/docs/api/</link>
</links>
<excludePackageNames>${javadoc.package.exclude}</excludePackageNames>
<bootclasspath>${sun.boot.class.path}</bootclasspath>
<doclet>com.google.doclava.Doclava</doclet>
<useStandardDocletOptions>false</useStandardDocletOptions>
......@@ -474,32 +444,6 @@
</plugins>
</reporting>
<profiles>
<profile>
<id>grizzly</id>
<activation>
<jdk>[1.6,)</jdk>
</activation>
<properties>
<compiler.exclude>asdfasfd/**</compiler.exclude>
<test.compiler.exclude>asdfasdf/**</test.compiler.exclude>
<javadoc.package.exclude>asdfasdf</javadoc.package.exclude>
<target.property>1.5</target.property>
</properties>
<dependencies>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-websockets</artifactId>
<version>${grizzly.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>${grizzly.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
......@@ -586,14 +530,13 @@
</repository>
</repositories>
<properties>
<additionalparam>-Xdoclint:none</additionalparam>
<distMgmtSnapshotsUrl>http://oss.sonatype.org/content/repositories/snapshots</distMgmtSnapshotsUrl>
<surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
<compiler.exclude>com/ning/http/client/providers/grizzly/*.java</compiler.exclude>
<test.compiler.exclude>com/ning/http/client/async/grizzly/*.java</test.compiler.exclude>
<javadoc.package.exclude>com.ning.http.client.providers.grizzly</javadoc.package.exclude>
<grizzly.version>2.3.14</grizzly.version>
<source.property>1.5</source.property>
<target.property>1.5</target.property>
<netty.version>3.10.6.Final</netty.version>
<grizzly.version>2.3.26</grizzly.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<surefire.version>2.12</surefire.version>
</properties>
</project>
......
......@@ -28,53 +28,40 @@ import org.slf4j.LoggerFactory;
*/
public abstract class AsyncCompletionHandler<T> implements AsyncHandler<T>, ProgressAsyncHandler<T> {
private final Logger log = LoggerFactory.getLogger(AsyncCompletionHandlerBase.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncCompletionHandler.class);
private final Response.ResponseBuilder builder = new Response.ResponseBuilder();
/**
* {@inheritDoc}
*/
@Override
public STATE onBodyPartReceived(final HttpResponseBodyPart content) throws Exception {
builder.accumulate(content);
return STATE.CONTINUE;
}
/**
* {@inheritDoc}
*/
@Override
public STATE onStatusReceived(final HttpResponseStatus status) throws Exception {
builder.reset();
builder.accumulate(status);
return STATE.CONTINUE;
}
/**
* {@inheritDoc}
*/
@Override
public STATE onHeadersReceived(final HttpResponseHeaders headers) throws Exception {
builder.accumulate(headers);
return STATE.CONTINUE;
}
/**
* {@inheritDoc}
*/
@Override
public final T onCompleted() throws Exception {
return onCompleted(builder.build());
}
/**
* {@inheritDoc}
*/
@Override
public void onThrowable(Throwable t) {
log.debug(t.getMessage(), t);
LOGGER.debug(t.getMessage(), t);
}
/**
* Invoked once the HTTP response processing is finished.
* <p/>
* <p/>
* Gets always invoked as last callback method.
*
* @param response The {@link Response}
* @return T Value that will be returned by the associated {@link java.util.concurrent.Future}
......@@ -88,6 +75,7 @@ public abstract class AsyncCompletionHandler<T> implements AsyncHandler<T>, Prog
*
* @return a {@link com.ning.http.client.AsyncHandler.STATE} telling to CONTINUE or ABORT the current processing.
*/
@Override
public STATE onHeaderWriteCompleted() {
return STATE.CONTINUE;
}
......@@ -98,6 +86,7 @@ public abstract class AsyncCompletionHandler<T> implements AsyncHandler<T>, Prog
*
* @return a {@link com.ning.http.client.AsyncHandler.STATE} telling to CONTINUE or ABORT the current processing.
*/
@Override
public STATE onContentWriteCompleted() {
return STATE.CONTINUE;
}
......@@ -110,6 +99,7 @@ public abstract class AsyncCompletionHandler<T> implements AsyncHandler<T>, Prog
* @param total The total number of bytes transferred
* @return a {@link com.ning.http.client.AsyncHandler.STATE} telling to CONTINUE or ABORT the current processing.
*/
@Override
public STATE onContentWriteProgress(long amount, long current, long total) {
return STATE.CONTINUE;
}
......
......@@ -23,21 +23,15 @@ import org.slf4j.LoggerFactory;
* Simple {@link AsyncHandler} of type {@link Response}
*/
public class AsyncCompletionHandlerBase extends AsyncCompletionHandler<Response> {
private final Logger log = LoggerFactory.getLogger(AsyncCompletionHandlerBase.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncCompletionHandlerBase.class);
/**
* {@inheritDoc}
*/
@Override
public Response onCompleted(Response response) throws Exception {
return response;
}
/**
* {@inheritDoc}
*/
/* @Override */
@Override
public void onThrowable(Throwable t) {
log.debug(t.getMessage(), t);
LOGGER.debug(t.getMessage(), t);
}
}
......@@ -12,6 +12,8 @@
*/
package com.ning.http.client;
import java.net.InetAddress;
/**
* This interface hosts new low level callback methods on {@link AsyncHandler}.
* For now, those methods are in a dedicated interface in order not to break the existing API,
......@@ -19,7 +21,6 @@ package com.ning.http.client;
*
* More additional hooks might come, such as:
* <ul>
* <li>onConnected()</li>
* <li>onConnectionClosed()</li>
* <li>onBytesSent(long numberOfBytes)</li>
* <li>onBytesReceived(long numberOfBytes)</li>
......@@ -28,15 +29,48 @@ package com.ning.http.client;
public interface AsyncHandlerExtensions {
/**
* Notify the callback when a request is being written on the wire.
* Notify the callback when trying to open a new connection.
*/
void onOpenConnection();
/**
* Notify the callback when a new connection was successfully opened.
*/
void onConnectionOpen();
/**
* Notify the callback when trying to fetch a connection from the pool.
*/
void onPoolConnection();
/**
* Notify the callback when a new connection was successfully fetched from the pool.
*/
void onConnectionPooled();
/**
* Notify the callback when a request is about to be written on the wire.
* If the original request causes multiple requests to be sent, for example, because of authorization or retry,
* it will be notified multiple times.
* Currently only supported by the Netty provider.
*
* @param request the real request object (underlying provider model)
*/
void onRequestSent();
void onSendRequest(Object request);
/**
* Notify the callback every time a request is being retried.
*/
void onRetry();
/**
* Notify the callback after DNS resolution has completed.
*
* @param address the resolved address
*/
void onDnsResolved(InetAddress address);
/**
* Notify the callback when the SSL handshake performed to establish an HTTPS connection has been completed.
*/
void onSslHandshakeCompleted();
}
......@@ -17,10 +17,10 @@
package com.ning.http.client;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -30,11 +30,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ning.http.client.Request.EntityWriter;
import com.ning.http.client.cookie.Cookie;
import com.ning.http.client.filter.FilterContext;
import com.ning.http.client.filter.FilterException;
import com.ning.http.client.filter.RequestFilter;
import com.ning.http.client.multipart.Part;
import com.ning.http.client.providers.jdk.JDKAsyncHttpProvider;
import com.ning.http.client.resumable.ResumableAsyncHandler;
......@@ -124,7 +124,7 @@ import com.ning.http.client.resumable.ResumableAsyncHandler;
* <p/>
* String bodyResponse = f.get();
* </pre></blockquote
* From any {@link HttpContent} sub classes, you can asynchronously process the response status,headers and body and decide when to
* From any content classes, you can asynchronously process the response status,headers and body and decide when to
* stop the processing the response by throwing a new {link ResponseComplete} at any moment.
* <p/>
* This class can also be used without the need of {@link AsyncHandler}</p>
......@@ -136,12 +136,12 @@ import com.ning.http.client.resumable.ResumableAsyncHandler;
* <p/>
* Finally, you can configure the AsyncHttpClient using an {@link AsyncHttpClientConfig} instance</p>
* <blockquote><pre>
* AsyncHttpClient c = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeoutInMs(...).build());
* AsyncHttpClient c = new AsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(...).build());
* Future<Response> f = c.prepareGet(TARGET_URL).execute();
* Response r = f.get();
* </pre></blockquote>
* <p/>
* An instance of this class will cache every HTTP 1.1 connections and close them when the {@link AsyncHttpClientConfig#getIdleConnectionTimeoutInMs()}
* An instance of this class will cache every HTTP 1.1 connections and close them when the {@link AsyncHttpClientConfig#getReadTimeout()}
* expires. This object can hold many persistent connections to different host.
*/
public class AsyncHttpClient implements Closeable {
......@@ -213,19 +213,19 @@ public class AsyncHttpClient implements Closeable {
public class BoundRequestBuilder extends RequestBuilderBase<BoundRequestBuilder> {
private BoundRequestBuilder(String reqType, boolean useRawUrl) {
super(BoundRequestBuilder.class, reqType, useRawUrl);
private BoundRequestBuilder(String method, boolean isDisableUrlEncoding) {
super(BoundRequestBuilder.class, method, isDisableUrlEncoding);
}
private BoundRequestBuilder(Request prototype) {
super(BoundRequestBuilder.class, prototype);
}
public <T> ListenableFuture<T> execute(AsyncHandler<T> handler) throws IOException {
public <T> ListenableFuture<T> execute(AsyncHandler<T> handler) {
return AsyncHttpClient.this.executeRequest(build(), handler);
}
public ListenableFuture<Response> execute() throws IOException {
public ListenableFuture<Response> execute() {
return AsyncHttpClient.this.executeRequest(build(), new AsyncCompletionHandlerBase());
}
......@@ -249,13 +249,13 @@ public class AsyncHttpClient implements Closeable {
}
@Override
public BoundRequestBuilder addParameter(String key, String value) {
return super.addParameter(key, value);
public BoundRequestBuilder addFormParam(String key, String value) {
return super.addFormParam(key, value);
}
@Override
public BoundRequestBuilder addQueryParameter(String name, String value) {
return super.addQueryParameter(name, value);
public BoundRequestBuilder addQueryParam(String name, String value) {
return super.addQueryParam(name, value);
}
@Override
......@@ -268,16 +268,6 @@ public class AsyncHttpClient implements Closeable {
return super.setBody(data);
}
@Override
public BoundRequestBuilder setBody(EntityWriter dataWriter, long length) {
return super.setBody(dataWriter, length);
}
@Override
public BoundRequestBuilder setBody(EntityWriter dataWriter) {
return super.setBody(dataWriter);
}
@Override
public BoundRequestBuilder setBody(InputStream stream) {
return super.setBody(stream);
......@@ -304,13 +294,13 @@ public class AsyncHttpClient implements Closeable {
}
@Override
public BoundRequestBuilder setParameters(Map<String, Collection<String>> parameters) {
return super.setParameters(parameters);
public BoundRequestBuilder setFormParams(Map<String, List<String>> params) {
return super.setFormParams(params);
}
@Override
public BoundRequestBuilder setParameters(FluentStringsMap parameters) {
return super.setParameters(parameters);
public BoundRequestBuilder setFormParams(List<Param> params) {
return super.setFormParams(params);
}
@Override
......@@ -472,6 +462,26 @@ public class AsyncHttpClient implements Closeable {
return requestBuilder("DELETE", url);
}
/**
* Prepare an HTTP client PATCH request.
*
* @param url A well formed URL.
* @return {@link RequestBuilder}
*/
public BoundRequestBuilder preparePatch(String url) {
return requestBuilder("PATCH", url);
}
/**
* Prepare an HTTP client TRACE request.
*
* @param url A well formed URL.
* @return {@link RequestBuilder}
*/
public BoundRequestBuilder prepareTrace(String url) {
return requestBuilder("TRACE", url);
}
/**
* Construct a {@link RequestBuilder} using a {@link Request}
*
......@@ -489,27 +499,33 @@ public class AsyncHttpClient implements Closeable {
* @param handler an instance of {@link AsyncHandler}
* @param <T> Type of the value that will be returned by the associated {@link java.util.concurrent.Future}
* @return a {@link Future} of type T
* @throws IOException
*/
public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler) throws IOException {
public <T> ListenableFuture<T> executeRequest(Request request, AsyncHandler<T> handler) {
if (config.getRequestFilters().isEmpty()) {
return httpProvider.execute(request, handler);
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(handler).request(request).build();
} else {
FilterContext<T> fc = new FilterContext.FilterContextBuilder<T>().asyncHandler(handler).request(request).build();
try {
fc = preProcessRequest(fc);
} catch (Exception e) {
handler.onThrowable(e);
return new ListenableFuture.CompletedFailure<T>("preProcessRequest failed", e);
}
return httpProvider.execute(fc.getRequest(), fc.getAsyncHandler());
}
}
/**
* Execute an HTTP request.
*
* @param request {@link Request}
* @return a {@link Future} of type Response
* @throws IOException
*/
public ListenableFuture<Response> executeRequest(Request request) throws IOException {
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(new AsyncCompletionHandlerBase()).request(request).build();
fc = preProcessRequest(fc);
return httpProvider.execute(fc.getRequest(), fc.getAsyncHandler());
public ListenableFuture<Response> executeRequest(Request request) {
return executeRequest(request, new AsyncCompletionHandlerBase());
}
/**
......@@ -518,18 +534,12 @@ public class AsyncHttpClient implements Closeable {
* @param fc {@link FilterContext}
* @return {@link FilterContext}
*/
private FilterContext preProcessRequest(FilterContext fc) throws IOException {
private <T> FilterContext<T> preProcessRequest(FilterContext<T> fc) throws FilterException {
for (RequestFilter asyncFilter : config.getRequestFilters()) {
try {
fc = asyncFilter.filter(fc);
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
} catch (FilterException e) {
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
}
Request request = fc.getRequest();
......@@ -542,7 +552,7 @@ public class AsyncHttpClient implements Closeable {
builder.setHeader("Range", "bytes=" + request.getRangeOffset() + "-");
request = builder.build();
}
fc = new FilterContext.FilterContextBuilder(fc).request(request).build();
fc = new FilterContext.FilterContextBuilder<T>(fc).request(request).build();
return fc;
}
......@@ -582,8 +592,8 @@ public class AsyncHttpClient implements Closeable {
}
}
protected BoundRequestBuilder requestBuilder(String reqType, String url) {
return new BoundRequestBuilder(reqType, config.isUseRawUrl()).setUrl(url).setSignatureCalculator(signatureCalculator);
protected BoundRequestBuilder requestBuilder(String method, String url) {
return new BoundRequestBuilder(method, config.isDisableUrlEncodingForBoundedRequests()).setUrl(url).setSignatureCalculator(signatureCalculator);
}
protected BoundRequestBuilder requestBuilder(Request prototype) {
......
......@@ -39,34 +39,34 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
}
void configureFilters() {
requestFilters = new LinkedList<RequestFilter>();
responseFilters = new LinkedList<ResponseFilter>();
ioExceptionFilters = new LinkedList<IOExceptionFilter>();
requestFilters = new LinkedList<>();
responseFilters = new LinkedList<>();
ioExceptionFilters = new LinkedList<>();
}
void configureDefaults() {
maxTotalConnections = defaultMaxTotalConnections();
maxConnectionPerHost = defaultMaxConnectionPerHost();
connectionTimeOutInMs = defaultConnectionTimeOutInMs();
webSocketIdleTimeoutInMs = defaultWebSocketIdleTimeoutInMs();
idleConnectionInPoolTimeoutInMs = defaultIdleConnectionInPoolTimeoutInMs();
idleConnectionTimeoutInMs = defaultIdleConnectionTimeoutInMs();
requestTimeoutInMs = defaultRequestTimeoutInMs();
maxConnectionLifeTimeInMs = defaultMaxConnectionLifeTimeInMs();
redirectEnabled = defaultRedirectEnabled();
maxConnections = defaultMaxConnections();
maxConnectionsPerHost = defaultMaxConnectionsPerHost();
connectTimeout = defaultConnectTimeout();
webSocketTimeout = defaultWebSocketTimeout();
pooledConnectionIdleTimeout = defaultPooledConnectionIdleTimeout();
readTimeout = defaultReadTimeout();
requestTimeout = defaultRequestTimeout();
connectionTTL = defaultConnectionTTL();
followRedirect = defaultFollowRedirect();
maxRedirects = defaultMaxRedirects();
compressionEnabled = defaultCompressionEnabled();
compressionEnforced = defaultCompressionEnforced();
userAgent = defaultUserAgent();
allowPoolingConnection = defaultAllowPoolingConnection();
useRelativeURIsWithSSLProxies = defaultUseRelativeURIsWithSSLProxies();
requestCompressionLevel = defaultRequestCompressionLevel();
allowPoolingConnections = defaultAllowPoolingConnections();
useRelativeURIsWithConnectProxies = defaultUseRelativeURIsWithConnectProxies();
maxRequestRetry = defaultMaxRequestRetry();
ioThreadMultiplier = defaultIoThreadMultiplier();
allowSslConnectionPool = defaultAllowSslConnectionPool();
useRawUrl = defaultUseRawUrl();
removeQueryParamOnRedirect = defaultRemoveQueryParamOnRedirect();
allowPoolingSslConnections = defaultAllowPoolingSslConnections();
disableUrlEncodingForBoundRequests = defaultDisableUrlEncodingForBoundRequests();
strict302Handling = defaultStrict302Handling();
hostnameVerifier = defaultHostnameVerifier();
acceptAnyCertificate = defaultAcceptAnyCertificate();
sslSessionCacheSize = defaultSslSessionCacheSize();
sslSessionTimeout = defaultSslSessionTimeout();
if (defaultUseProxySelector()) {
proxyServerSelector = ProxyUtils.getJdkDefaultProxyServerSelector();
......@@ -86,22 +86,22 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
}
public AsyncHttpClientConfigBean setMaxTotalConnections(int maxTotalConnections) {
this.maxTotalConnections = maxTotalConnections;
this.maxConnections = maxTotalConnections;
return this;
}
public AsyncHttpClientConfigBean setMaxConnectionPerHost(int maxConnectionPerHost) {
this.maxConnectionPerHost = maxConnectionPerHost;
this.maxConnectionsPerHost = maxConnectionPerHost;
return this;
}
public AsyncHttpClientConfigBean setConnectionTimeOutInMs(int connectionTimeOutInMs) {
this.connectionTimeOutInMs = connectionTimeOutInMs;
public AsyncHttpClientConfigBean setConnectionTimeOut(int connectionTimeOut) {
this.connectTimeout = connectionTimeOut;
return this;
}
public AsyncHttpClientConfigBean setIdleConnectionInPoolTimeoutInMs(int idleConnectionInPoolTimeoutInMs) {
this.idleConnectionInPoolTimeoutInMs = idleConnectionInPoolTimeoutInMs;
public AsyncHttpClientConfigBean setIdleConnectionInPoolTimeout(int idleConnectionInPoolTimeout) {
this.pooledConnectionIdleTimeout = idleConnectionInPoolTimeout;
return this;
}
......@@ -110,23 +110,23 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
return this;
}
public AsyncHttpClientConfigBean setIdleConnectionTimeoutInMs(int idleConnectionTimeoutInMs) {
this.idleConnectionTimeoutInMs = idleConnectionTimeoutInMs;
public AsyncHttpClientConfigBean setReadTimeout(int readTimeout) {
this.readTimeout = readTimeout;
return this;
}
public AsyncHttpClientConfigBean setRequestTimeoutInMs(int requestTimeoutInMs) {
this.requestTimeoutInMs = requestTimeoutInMs;
public AsyncHttpClientConfigBean setRequestTimeout(int requestTimeout) {
this.requestTimeout = requestTimeout;
return this;
}
public AsyncHttpClientConfigBean setMaxConnectionLifeTimeInMs(int maxConnectionLifeTimeInMs) {
this.maxConnectionLifeTimeInMs = maxConnectionLifeTimeInMs;
public AsyncHttpClientConfigBean setMaxConnectionLifeTime(int maxConnectionLifeTime) {
this.connectionTTL = maxConnectionLifeTime;
return this;
}
public AsyncHttpClientConfigBean setRedirectEnabled(boolean redirectEnabled) {
this.redirectEnabled = redirectEnabled;
public AsyncHttpClientConfigBean setFollowRedirect(boolean followRedirect) {
this.followRedirect = followRedirect;
return this;
}
......@@ -135,8 +135,8 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
return this;
}
public AsyncHttpClientConfigBean setCompressionEnabled(boolean compressionEnabled) {
this.compressionEnabled = compressionEnabled;
public AsyncHttpClientConfigBean setCompressionEnforced(boolean compressionEnforced) {
this.compressionEnforced = compressionEnforced;
return this;
}
......@@ -146,7 +146,7 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
}
public AsyncHttpClientConfigBean setAllowPoolingConnection(boolean allowPoolingConnection) {
this.allowPoolingConnection = allowPoolingConnection;
this.allowPoolingConnections = allowPoolingConnection;
return this;
}
......@@ -173,21 +173,11 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
return this;
}
public AsyncHttpClientConfigBean setSslEngineFactory(SSLEngineFactory sslEngineFactory) {
this.sslEngineFactory = sslEngineFactory;
return this;
}
public AsyncHttpClientConfigBean setProviderConfig(AsyncHttpProviderConfig<?, ?> providerConfig) {
this.providerConfig = providerConfig;
return this;
}
public AsyncHttpClientConfigBean setConnectionsPool(ConnectionsPool<?, ?> connectionsPool) {
this.connectionsPool = connectionsPool;
return this;
}
public AsyncHttpClientConfigBean setRealm(Realm realm) {
this.realm = realm;
return this;
......@@ -208,28 +198,18 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
return this;
}
public AsyncHttpClientConfigBean setRequestCompressionLevel(int requestCompressionLevel) {
this.requestCompressionLevel = requestCompressionLevel;
return this;
}
public AsyncHttpClientConfigBean setMaxRequestRetry(int maxRequestRetry) {
this.maxRequestRetry = maxRequestRetry;
return this;
}
public AsyncHttpClientConfigBean setAllowSslConnectionPool(boolean allowSslConnectionPool) {
this.allowSslConnectionPool = allowSslConnectionPool;
this.allowPoolingSslConnections = allowSslConnectionPool;
return this;
}
public AsyncHttpClientConfigBean setUseRawUrl(boolean useRawUrl) {
this.useRawUrl = useRawUrl;
return this;
}
public AsyncHttpClientConfigBean setRemoveQueryParamOnRedirect(boolean removeQueryParamOnRedirect) {
this.removeQueryParamOnRedirect = removeQueryParamOnRedirect;
public AsyncHttpClientConfigBean setDisableUrlEncodingForBoundRequests(boolean disableUrlEncodingForBoundRequests) {
this.disableUrlEncodingForBoundRequests = disableUrlEncodingForBoundRequests;
return this;
}
......@@ -242,4 +222,19 @@ public class AsyncHttpClientConfigBean extends AsyncHttpClientConfig {
this.ioThreadMultiplier = ioThreadMultiplier;
return this;
}
public AsyncHttpClientConfigBean setAcceptAnyCertificate(boolean acceptAnyCertificate) {
this.acceptAnyCertificate = acceptAnyCertificate;
return this;
}
public AsyncHttpClientConfigBean setSslSessionCacheSize(Integer sslSessionCacheSize) {
this.sslSessionCacheSize = sslSessionCacheSize;
return this;
}
public AsyncHttpClientConfigBean setSslSessionTimeout(Integer sslSessionTimeout) {
this.sslSessionTimeout = sslSessionTimeout;
return this;
}
}
......@@ -12,10 +12,7 @@
*/
package com.ning.http.client;
import com.ning.http.util.AllowAllHostnameVerifier;
import static com.ning.http.util.MiscUtil.getBoolean;
import javax.net.ssl.HostnameVerifier;
import static com.ning.http.util.MiscUtils.getBoolean;
public final class AsyncHttpClientConfigDefaults {
......@@ -24,52 +21,52 @@ public final class AsyncHttpClientConfigDefaults {
public static final String ASYNC_CLIENT = AsyncHttpClientConfig.class.getName() + ".";
public static int defaultMaxTotalConnections() {
return Integer.getInteger(ASYNC_CLIENT + "maxTotalConnections", -1);
public static int defaultMaxConnections() {
return Integer.getInteger(ASYNC_CLIENT + "maxConnections", -1);
}
public static int defaultMaxConnectionPerHost() {
public static int defaultMaxConnectionsPerHost() {
return Integer.getInteger(ASYNC_CLIENT + "maxConnectionsPerHost", -1);
}
public static int defaultConnectionTimeOutInMs() {
return Integer.getInteger(ASYNC_CLIENT + "connectionTimeoutInMs", 60 * 1000);
public static int defaultConnectTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "connectTimeout", 5 * 1000);
}
public static int defaultIdleConnectionInPoolTimeoutInMs() {
return Integer.getInteger(ASYNC_CLIENT + "idleConnectionInPoolTimeoutInMs", 60 * 1000);
public static int defaultPooledConnectionIdleTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "pooledConnectionIdleTimeout", 60 * 1000);
}
public static int defaultIdleConnectionTimeoutInMs() {
return Integer.getInteger(ASYNC_CLIENT + "idleConnectionTimeoutInMs", 60 * 1000);
public static int defaultReadTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "readTimeout", 60 * 1000);
}
public static int defaultRequestTimeoutInMs() {
return Integer.getInteger(ASYNC_CLIENT + "requestTimeoutInMs", 60 * 1000);
public static int defaultRequestTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "requestTimeout", 60 * 1000);
}
public static int defaultWebSocketIdleTimeoutInMs() {
return Integer.getInteger(ASYNC_CLIENT + "webSocketTimoutInMS", 15 * 60 * 1000);
public static int defaultWebSocketTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "webSocketTimeout", 15 * 60 * 1000);
}
public static int defaultMaxConnectionLifeTimeInMs() {
return Integer.getInteger(ASYNC_CLIENT + "maxConnectionLifeTimeInMs", -1);
public static int defaultConnectionTTL() {
return Integer.getInteger(ASYNC_CLIENT + "connectionTTL", -1);
}
public static boolean defaultRedirectEnabled() {
return Boolean.getBoolean(ASYNC_CLIENT + "redirectsEnabled");
public static boolean defaultFollowRedirect() {
return Boolean.getBoolean(ASYNC_CLIENT + "followRedirect");
}
public static int defaultMaxRedirects() {
return Integer.getInteger(ASYNC_CLIENT + "maxRedirects", 5);
}
public static boolean defaultCompressionEnabled() {
return Boolean.getBoolean(ASYNC_CLIENT + "compressionEnabled");
public static boolean defaultCompressionEnforced() {
return getBoolean(ASYNC_CLIENT + "compressionEnforced", false);
}
public static String defaultUserAgent() {
return System.getProperty(ASYNC_CLIENT + "userAgent", "NING/1.0");
return System.getProperty(ASYNC_CLIENT + "userAgent", "AHC/1.0");
}
public static int defaultIoThreadMultiplier() {
......@@ -88,36 +85,39 @@ public final class AsyncHttpClientConfigDefaults {
return Boolean.getBoolean(ASYNC_CLIENT + "strict302Handling");
}
public static boolean defaultAllowPoolingConnection() {
return getBoolean(ASYNC_CLIENT + "allowPoolingConnection", true);
}
public static boolean defaultUseRelativeURIsWithSSLProxies() {
return getBoolean(ASYNC_CLIENT + "useRelativeURIsWithSSLProxies", true);
public static boolean defaultAllowPoolingConnections() {
return getBoolean(ASYNC_CLIENT + "allowPoolingConnections", true);
}
// unused/broken, left there for compatibility, fixed in Netty 4
public static int defaultRequestCompressionLevel() {
return Integer.getInteger(ASYNC_CLIENT + "requestCompressionLevel", -1);
public static boolean defaultUseRelativeURIsWithConnectProxies() {
return getBoolean(ASYNC_CLIENT + "useRelativeURIsWithConnectProxies", true);
}
public static int defaultMaxRequestRetry() {
return Integer.getInteger(ASYNC_CLIENT + "maxRequestRetry", 5);
}
public static boolean defaultAllowSslConnectionPool() {
return getBoolean(ASYNC_CLIENT + "allowSslConnectionPool", true);
public static boolean defaultAllowPoolingSslConnections() {
return getBoolean(ASYNC_CLIENT + "allowPoolingSslConnections", true);
}
public static boolean defaultDisableUrlEncodingForBoundRequests() {
return Boolean.getBoolean(ASYNC_CLIENT + "disableUrlEncodingForBoundRequests");
}
public static boolean defaultAcceptAnyCertificate() {
return getBoolean(ASYNC_CLIENT + "acceptAnyCertificate", false);
}
public static boolean defaultUseRawUrl() {
return Boolean.getBoolean(ASYNC_CLIENT + "useRawUrl");
public static Integer defaultSslSessionCacheSize() {
return Integer.getInteger(ASYNC_CLIENT + "sslSessionCacheSize");
}
public static boolean defaultRemoveQueryParamOnRedirect() {
return getBoolean(ASYNC_CLIENT + "removeQueryParamOnRedirect", true);
public static Integer defaultSslSessionTimeout() {
return Integer.getInteger(ASYNC_CLIENT + "sslSessionTimeout");
}
public static HostnameVerifier defaultHostnameVerifier() {
return new AllowAllHostnameVerifier();
public static String[] defaultEnabledProtocols() {
return new String[] { "TLSv1.2", "TLSv1.1", "TLSv1" };
}
}
......@@ -15,9 +15,6 @@
*/
package com.ning.http.client;
import java.io.IOException;
import java.util.List;
/**
* Interface to be used when implementing custom asynchronous I/O HTTP client.
* By default, the {@link com.ning.http.client.providers.netty.NettyAsyncHttpProvider} is used.
......@@ -29,24 +26,11 @@ public interface AsyncHttpProvider {
*
* @param handler an instance of {@link AsyncHandler}
* @return a {@link ListenableFuture} of Type T.
* @throws IOException
*/
<T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler) throws IOException;
<T> ListenableFuture<T> execute(Request request, AsyncHandler<T> handler);
/**
* Close the current underlying TCP/HTTP connection.
*/
void close();
/**
* Prepare a {@link Response}
*
* @param status {@link HttpResponseStatus}
* @param headers {@link HttpResponseHeaders}
* @param bodyParts list of {@link HttpResponseBodyPart}
* @return a {@link Response}
*/
Response prepareResponse(HttpResponseStatus status,
HttpResponseHeaders headers,
List<HttpResponseBodyPart> bodyParts);
}