com.ning.http.client.providers
Class NettyAsyncHttpProvider

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelUpstreamHandler
      extended by com.ning.http.client.providers.NettyAsyncHttpProvider
All Implemented Interfaces:
AsyncHttpProvider<org.jboss.netty.handler.codec.http.HttpResponse>, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class NettyAsyncHttpProvider
extends org.jboss.netty.channel.SimpleChannelUpstreamHandler
implements AsyncHttpProvider<org.jboss.netty.handler.codec.http.HttpResponse>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Constructor Summary
NettyAsyncHttpProvider(AsyncHttpClientConfig config)
           
 
Method Summary
 void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
           
 void close()
          Close the current underlying TCP/HTTP connection.s
 void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
           
<T> Future<T>
execute(Request request, AsyncHandler<T> asyncHandler)
          Execute the request and invoke the AsyncHandler when the response arrive.
 void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
           
 Response prepareResponse(HttpResponseStatus status, HttpResponseHeaders headers, Collection<HttpResponseBodyPart> bodyParts)
          Prepare a Response
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NettyAsyncHttpProvider

public NettyAsyncHttpProvider(AsyncHttpClientConfig config)
Method Detail

close

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

Specified by:
close in interface AsyncHttpProvider<org.jboss.netty.handler.codec.http.HttpResponse>

prepareResponse

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

Specified by:
prepareResponse in interface AsyncHttpProvider<org.jboss.netty.handler.codec.http.HttpResponse>
Parameters:
status - HttpResponseStatus
headers - HttpResponseHeaders
bodyParts - list of HttpResponseBodyPart
Returns:
a Response

execute

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

Specified by:
execute in interface AsyncHttpProvider<org.jboss.netty.handler.codec.http.HttpResponse>
asyncHandler - an instance of AsyncHandler
Returns:
a Future of Type T.
Throws:
IOException

messageReceived

public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.MessageEvent e)
                     throws Exception
Overrides:
messageReceived in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Throws:
Exception

channelClosed

public void channelClosed(org.jboss.netty.channel.ChannelHandlerContext ctx,
                          org.jboss.netty.channel.ChannelStateEvent e)
                   throws Exception
Overrides:
channelClosed in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Throws:
Exception

exceptionCaught

public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.ExceptionEvent e)
                     throws Exception
Overrides:
exceptionCaught in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Throws:
Exception


Copyright © 2010. All Rights Reserved.