com.ning.http.client.providers.grizzly
Class GrizzlyAsyncHttpProvider

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

public class GrizzlyAsyncHttpProvider
extends Object
implements AsyncHttpProvider

A Grizzly 2.0-based implementation of AsyncHttpProvider.

Since:
1.7.0
Author:
The Grizzly Team

Constructor Summary
GrizzlyAsyncHttpProvider(AsyncHttpClientConfig clientConfig)
           
 
Method Summary
 void close()
          Close the current underlying TCP/HTTP connection.
protected
<T> ListenableFuture<T>
execute(org.glassfish.grizzly.Connection c, Request request, AsyncHandler<T> handler, GrizzlyResponseFuture<T> future)
           
<T> ListenableFuture<T>
execute(Request request, AsyncHandler<T> handler)
          Execute the request and invoke the AsyncHandler when the response arrive.
protected  void initializeTransport(AsyncHttpClientConfig clientConfig)
           
static void main(String[] args)
           
 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

GrizzlyAsyncHttpProvider

public GrizzlyAsyncHttpProvider(AsyncHttpClientConfig clientConfig)
Method Detail

execute

public <T> ListenableFuture<T> execute(Request request,
                                       AsyncHandler<T> handler)
                            throws IOException
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()
Close the current underlying TCP/HTTP connection.

Specified by:
close in interface AsyncHttpProvider

prepareResponse

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

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

execute

protected <T> ListenableFuture<T> execute(org.glassfish.grizzly.Connection c,
                                          Request request,
                                          AsyncHandler<T> handler,
                                          GrizzlyResponseFuture<T> future)
                               throws IOException
Throws:
IOException

initializeTransport

protected void initializeTransport(AsyncHttpClientConfig clientConfig)

main

public static void main(String[] args)


Copyright © 2014. All Rights Reserved.