public class SimpleAsyncHttpClient extends Object
AsyncHttpClient and it's related builders (AsyncHttpClientConfig,
 Realm, ProxyServer and AsyncHandler. You can
 build powerful application by just using this class.
 
 This class rely on BodyGenerator and BodyConsumer for handling the request and response body. No
 AsyncHandler are required. As simple as:
 
 SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder()
 .setIdleConnectionInPoolTimeoutInMs(100)
 .setMaximumConnectionsTotal(50)
 .setRequestTimeoutInMs(5 * 60 * 1000)
 .setUrl(getTargetUrl())
 .setHeader("Content-Type", "text/html").build();
 <p/>
 StringBuilder s = new StringBuilder();
 Future<Response> future = client.post(new InputStreamBodyGenerator(new ByteArrayInputStream(MY_MESSAGE.getBytes())), new AppendableBodyConsumer(s));
 
 or
 public void ByteArrayOutputStreamBodyConsumerTest() throws Throwable {
 <p/>
 SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder()
 .setUrl(getTargetUrl())
 .build();
 <p/>
 ByteArrayOutputStream o = new ByteArrayOutputStream(10);
 Future<Response> future = client.post(new FileodyGenerator(myFile), new OutputStreamBodyConsumer(o));
 }
 | Modifier and Type | Class and Description | 
|---|---|
static class  | 
SimpleAsyncHttpClient.Builder  | 
static interface  | 
SimpleAsyncHttpClient.DerivedBuilder
This interface contains possible configuration changes for a derived SimpleAsyncHttpClient. 
 | 
static class  | 
SimpleAsyncHttpClient.ErrorDocumentBehaviour  | 
public Future<Response> post(Part... parts) throws IOException
IOExceptionpublic Future<Response> post(BodyConsumer consumer, Part... parts) throws IOException
IOExceptionpublic Future<Response> post(BodyGenerator bodyGenerator) throws IOException
IOExceptionpublic Future<Response> post(BodyGenerator bodyGenerator, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> post(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException
IOExceptionpublic Future<Response> post(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> put(Part... parts) throws IOException
IOExceptionpublic Future<Response> put(BodyConsumer consumer, Part... parts) throws IOException
IOExceptionpublic Future<Response> put(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException
IOExceptionpublic Future<Response> put(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> put(BodyGenerator bodyGenerator) throws IOException
IOExceptionpublic Future<Response> put(BodyGenerator bodyGenerator, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> get() throws IOException
IOExceptionpublic Future<Response> get(ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> get(BodyConsumer bodyConsumer) throws IOException
IOExceptionpublic Future<Response> get(BodyConsumer bodyConsumer, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> delete() throws IOException
IOExceptionpublic Future<Response> delete(ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> delete(BodyConsumer bodyConsumer) throws IOException
IOExceptionpublic Future<Response> delete(BodyConsumer bodyConsumer, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> head() throws IOException
IOExceptionpublic Future<Response> head(ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> options() throws IOException
IOExceptionpublic Future<Response> options(ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic Future<Response> options(BodyConsumer bodyConsumer) throws IOException
IOExceptionpublic Future<Response> options(BodyConsumer bodyConsumer, ThrowableHandler throwableHandler) throws IOException
IOExceptionpublic void close()
derive(), 
AsyncHttpClient.close()public SimpleAsyncHttpClient.DerivedBuilder derive()
AsyncHttpClient to execute requests.
 
 
 
 The original SimpleAsyncHttpClient is responsible for managing the
 underlying AsyncHttpClient. For the derived instance, close() is
 a NOOP. If the original SimpleAsyncHttpClient is closed, all derived
 instances become invalid.AsyncHttpClient to execute requests, never
         null.Copyright © 2015. All rights reserved.