com.ning.http.client
Interface AsyncHttpProvider

All Known Implementing Classes:
ApacheAsyncHttpProvider, JDKAsyncHttpProvider, NettyAsyncHttpProvider

public interface AsyncHttpProvider

Interface to be used when implementing custom asynchronous I/O HTTP client. By default, the NettyAsyncHttpProvider is used.


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, Collection<HttpResponseBodyPart> bodyParts)
          Prepare a Response
 

Method Detail

execute

<T> ListenableFuture<T> execute(Request request,
                                AsyncHandler<T> handler)
                            throws IOException
Execute the request and invoke the AsyncHandler when the response arrive.

Parameters:
handler - an instance of AsyncHandler
Returns:
a ListenableFuture of Type T.
Throws:
IOException

close

void close()
Close the current underlying TCP/HTTP connection.


prepareResponse

Response prepareResponse(HttpResponseStatus status,
                         HttpResponseHeaders headers,
                         Collection<HttpResponseBodyPart> bodyParts)
Prepare a Response

Parameters:
status - HttpResponseStatus
headers - HttpResponseHeaders
bodyParts - list of HttpResponseBodyPart
Returns:
a Response


Copyright © 2011. All Rights Reserved.