com.ning.http.client.providers.apache
Class ApacheAsyncHttpProvider

java.lang.Object
  extended by com.ning.http.client.providers.apache.ApacheAsyncHttpProvider
All Implemented Interfaces:
AsyncHttpProvider

public class ApacheAsyncHttpProvider
extends Object
implements AsyncHttpProvider

An AsyncHttpProvider for Apache Http Client 3.1


Nested Class Summary
 class ApacheAsyncHttpProvider.ApacheClientRunnable<T>
           
 
Constructor Summary
ApacheAsyncHttpProvider(AsyncHttpClientConfig config)
           
 
Method Summary
 void close()
          Close the current underlying TCP/HTTP connection.
<T> ListenableFuture<T>
execute(Request request, AsyncHandler<T> handler)
          Execute the request and invoke the AsyncHandler when the response arrive.
 Response prepareResponse(HttpResponseStatus status, HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts)
          Prepare a Response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApacheAsyncHttpProvider

public ApacheAsyncHttpProvider(AsyncHttpClientConfig config)
Method Detail

execute

public <T> ListenableFuture<T> execute(Request request,
                                       AsyncHandler<T> handler)
                            throws IOException
Description copied from interface: AsyncHttpProvider
Execute the request and invoke the AsyncHandler when the response arrive.

Specified by:
execute in interface AsyncHttpProvider
handler - an instance of AsyncHandler
Returns:
a ListenableFuture of Type T.
Throws:
IOException

close

public void close()
Description copied from interface: AsyncHttpProvider
Close the current underlying TCP/HTTP connection.

Specified by:
close in interface AsyncHttpProvider

prepareResponse

public Response prepareResponse(HttpResponseStatus status,
                                HttpResponseHeaders headers,
                                List<HttpResponseBodyPart> bodyParts)
Description copied from interface: AsyncHttpProvider
Prepare a Response

Specified by:
prepareResponse in interface AsyncHttpProvider
Parameters:
status - HttpResponseStatus
headers - HttpResponseHeaders
bodyParts - list of HttpResponseBodyPart
Returns:
a Response


Copyright © 2014. All Rights Reserved.