public class NettyAsyncHttpProvider extends org.jboss.netty.channel.SimpleChannelUpstreamHandler implements AsyncHttpProvider
| Modifier and Type | Class and Description |
|---|---|
static class |
NettyAsyncHttpProvider.OptimizedFileRegion |
static class |
NettyAsyncHttpProvider.ThreadLocalBoolean |
| Modifier and Type | Field and Description |
|---|---|
static String |
GZIP_DEFLATE |
static String |
HTTP_HANDLER |
static String |
HTTP_PROCESSOR |
static IOException |
REMOTELY_CLOSED_EXCEPTION |
static String |
SSL_HANDLER |
static String |
WS_PROCESSOR |
| Constructor and Description |
|---|
NettyAsyncHttpProvider(AsyncHttpClientConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(NettyResponseFuture<?> future,
Throwable t) |
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 org.jboss.netty.handler.codec.http.HttpRequest |
buildRequest(AsyncHttpClientConfig config,
Request request,
UriComponents uri,
boolean allowConnect,
org.jboss.netty.buffer.ChannelBuffer buffer,
ProxyServer proxyServer) |
void |
channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e) |
void |
close()
Close the current underlying TCP/HTTP connection.
|
void |
exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent e) |
<T> ListenableFuture<T> |
execute(Request request,
AsyncHandler<T> asyncHandler)
Execute the request and invoke the
AsyncHandler when the response arrive. |
AsyncHttpClientConfig |
getConfig() |
boolean |
isClose() |
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e) |
static <T> NettyResponseFuture<T> |
newFuture(UriComponents uri,
Request request,
AsyncHandler<T> asyncHandler,
org.jboss.netty.handler.codec.http.HttpRequest nettyRequest,
AsyncHttpClientConfig config,
ProxyServer proxyServer) |
org.jboss.netty.util.Timeout |
newTimeout(org.jboss.netty.util.TimerTask task,
long delay) |
Response |
prepareResponse(HttpResponseStatus status,
HttpResponseHeaders headers,
List<HttpResponseBodyPart> bodyParts)
Prepare a
Response |
protected boolean |
retry(org.jboss.netty.channel.Channel channel,
NettyResponseFuture<?> future) |
protected <T> void |
writeRequest(org.jboss.netty.channel.Channel channel,
AsyncHttpClientConfig config,
NettyResponseFuture<T> future) |
public static final String GZIP_DEFLATE
public static final IOException REMOTELY_CLOSED_EXCEPTION
public static final String HTTP_HANDLER
public static final String SSL_HANDLER
public static final String HTTP_PROCESSOR
public static final String WS_PROCESSOR
public NettyAsyncHttpProvider(AsyncHttpClientConfig config)
protected final <T> void writeRequest(org.jboss.netty.channel.Channel channel,
AsyncHttpClientConfig config,
NettyResponseFuture<T> future)
protected static final org.jboss.netty.handler.codec.http.HttpRequest buildRequest(AsyncHttpClientConfig config, Request request, UriComponents uri, boolean allowConnect, org.jboss.netty.buffer.ChannelBuffer buffer, ProxyServer proxyServer) throws IOException
IOExceptionpublic void close()
AsyncHttpProviderclose in interface AsyncHttpProviderpublic Response prepareResponse(HttpResponseStatus status, HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts)
AsyncHttpProviderResponseprepareResponse in interface AsyncHttpProviderstatus - HttpResponseStatusheaders - HttpResponseHeadersbodyParts - list of HttpResponseBodyPartResponsepublic <T> ListenableFuture<T> execute(Request request, AsyncHandler<T> asyncHandler) throws IOException
AsyncHttpProviderAsyncHandler when the response arrive.execute in interface AsyncHttpProviderasyncHandler - an instance of AsyncHandlerListenableFuture of Type T.IOExceptionpublic void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e)
throws Exception
messageReceived in class org.jboss.netty.channel.SimpleChannelUpstreamHandlerExceptionpublic void abort(NettyResponseFuture<?> future, Throwable t)
public void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
throws Exception
channelClosed in class org.jboss.netty.channel.SimpleChannelUpstreamHandlerExceptionprotected boolean retry(org.jboss.netty.channel.Channel channel,
NettyResponseFuture<?> future)
public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent e)
throws Exception
exceptionCaught in class org.jboss.netty.channel.SimpleChannelUpstreamHandlerExceptionprotected static boolean abortOnConnectCloseException(Throwable cause)
protected static boolean abortOnDisconnectException(Throwable cause)
protected static boolean abortOnReadCloseException(Throwable cause)
protected static boolean abortOnWriteCloseException(Throwable cause)
public static <T> NettyResponseFuture<T> newFuture(UriComponents uri, Request request, AsyncHandler<T> asyncHandler, org.jboss.netty.handler.codec.http.HttpRequest nettyRequest, AsyncHttpClientConfig config, ProxyServer proxyServer)
public AsyncHttpClientConfig getConfig()
public boolean isClose()
public org.jboss.netty.util.Timeout newTimeout(org.jboss.netty.util.TimerTask task,
long delay)
Copyright © 2014. All Rights Reserved.