public class

NettyAsyncHttpProvider

extends SimpleChannelUpstreamHandler
implements AsyncHttpProvider
java.lang.Object
   ↳ org.jboss.netty.channel.SimpleChannelUpstreamHandler
     ↳ com.ning.http.client.providers.netty.NettyAsyncHttpProvider

Summary

Nested Classes
class NettyAsyncHttpProvider.OptimizedFileRegion  
class NettyAsyncHttpProvider.ThreadLocalBoolean  
Constants
ThreadLocal<Boolean> IN_IO_THREAD
String SSL_HANDLER
Public Constructors
NettyAsyncHttpProvider(AsyncHttpClientConfig config)
Public Methods
void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
void close()
Close the current underlying TCP/HTTP connection.
void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
<T> ListenableFuture<T> execute(Request request, AsyncHandler<T> asyncHandler)
Execute the request and invoke the AsyncHandler when the response arrive.
void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
static <T> NettyResponseFuture<T> newFuture(URI uri, Request request, AsyncHandler<T> asyncHandler, HttpRequest nettyRequest, AsyncHttpClientConfig config, NettyAsyncHttpProvider provider)
Response prepareResponse(HttpResponseStatus status, HttpResponseHeaders headers, Collection<HttpResponseBodyPart> bodyParts)
Prepare a Response
String toString()
Protected Methods
static boolean abortOnConnectCloseException(Throwable cause)
static boolean abortOnDisconnectException(Throwable cause)
static boolean abortOnReadCloseException(Throwable cause)
static boolean abortOnWriteCloseException(Throwable cause)
final static HttpRequest buildRequest(AsyncHttpClientConfig config, Request request, URI uri, boolean allowConnect, ChannelBuffer buffer)
AsyncHttpClientConfig getConfig()
boolean remotelyClosed(Channel channel, NettyResponseFuture<?> future)
static int requestTimeout(AsyncHttpClientConfig config, PerRequestConfig perRequestConfig)
final <T> void writeRequest(Channel channel, AsyncHttpClientConfig config, NettyResponseFuture<T> future, HttpRequest nettyRequest)
[Expand]
Inherited Methods
From class org.jboss.netty.channel.SimpleChannelUpstreamHandler
From class java.lang.Object
From interface com.ning.http.client.AsyncHttpProvider
From interface org.jboss.netty.channel.ChannelUpstreamHandler

Constants

public static final ThreadLocal<Boolean> IN_IO_THREAD

protected static final String SSL_HANDLER

Constant Value: "sslHandler"

Public Constructors

public NettyAsyncHttpProvider (AsyncHttpClientConfig config)

Public Methods

public void channelClosed (ChannelHandlerContext ctx, ChannelStateEvent e)

Throws
Exception

public void close ()

Close the current underlying TCP/HTTP connection.

public void exceptionCaught (ChannelHandlerContext ctx, ExceptionEvent e)

Throws
Exception

public ListenableFuture<T> execute (Request request, AsyncHandler<T> asyncHandler)

Execute the request and invoke the AsyncHandler when the response arrive.

Parameters
asyncHandler an instance of AsyncHandler
Returns
Throws
IOException

public void messageReceived (ChannelHandlerContext ctx, MessageEvent e)

Throws
Exception

public static NettyResponseFuture<T> newFuture (URI uri, Request request, AsyncHandler<T> asyncHandler, HttpRequest nettyRequest, AsyncHttpClientConfig config, NettyAsyncHttpProvider provider)

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

Prepare a Response

Parameters
status HttpResponseStatus
headers HttpResponseHeaders
bodyParts list of HttpResponseBodyPart
Returns

public String toString ()

Protected Methods

protected static boolean abortOnConnectCloseException (Throwable cause)

protected static boolean abortOnDisconnectException (Throwable cause)

protected static boolean abortOnReadCloseException (Throwable cause)

protected static boolean abortOnWriteCloseException (Throwable cause)

protected static final HttpRequest buildRequest (AsyncHttpClientConfig config, Request request, URI uri, boolean allowConnect, ChannelBuffer buffer)

Throws
IOException

protected AsyncHttpClientConfig getConfig ()

protected boolean remotelyClosed (Channel channel, NettyResponseFuture<?> future)

protected static int requestTimeout (AsyncHttpClientConfig config, PerRequestConfig perRequestConfig)

protected final void writeRequest (Channel channel, AsyncHttpClientConfig config, NettyResponseFuture<T> future, HttpRequest nettyRequest)