rabbit.httpio
Class HttpResponseReader

java.lang.Object
  extended by rabbit.httpio.HttpResponseReader
All Implemented Interfaces:
AsyncListener, HttpHeaderListener, HttpHeaderSentListener

public class HttpResponseReader
extends Object
implements HttpHeaderSentListener, HttpHeaderListener

A handler that write one http header and reads a response

Author:
Robert Olofsson

Constructor Summary
HttpResponseReader(SocketChannel channel, NioHandler nioHandler, TrafficLogger tl, BufferHandler bufHandler, HttpHeader header, boolean fullURI, boolean strictHttp, HttpResponseListener listener)
           
 
Method Summary
 void closed()
          The socket connection has been closed, either by this end or the other side.
 void failed(Exception cause)
          Reading failed
 void httpHeaderRead(HttpHeader header, BufferHandle bh, boolean keepalive, boolean isChunked, long dataSize)
          One http header has been read
 void httpHeaderSent()
          The http header has been sent.
 void sendRequestAndWaitForResponse()
           
 void timeout()
          The operation timed out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpResponseReader

public HttpResponseReader(SocketChannel channel,
                          NioHandler nioHandler,
                          TrafficLogger tl,
                          BufferHandler bufHandler,
                          HttpHeader header,
                          boolean fullURI,
                          boolean strictHttp,
                          HttpResponseListener listener)
                   throws IOException
Throws:
IOException
Method Detail

sendRequestAndWaitForResponse

public void sendRequestAndWaitForResponse()
                                   throws IOException
Throws:
IOException

httpHeaderSent

public void httpHeaderSent()
Description copied from interface: HttpHeaderSentListener
The http header has been sent.

Specified by:
httpHeaderSent in interface HttpHeaderSentListener

httpHeaderRead

public void httpHeaderRead(HttpHeader header,
                           BufferHandle bh,
                           boolean keepalive,
                           boolean isChunked,
                           long dataSize)
Description copied from interface: HttpHeaderListener
One http header has been read

Specified by:
httpHeaderRead in interface HttpHeaderListener
Parameters:
header - the HttpHeader that was read
bh - the BufferHandle that may or may not hold unread data.
keepalive - if the sender want to use keepalive.
isChunked - if false content is not chunked, if true content is chunked.
dataSize - the contents size or -1 if size is unknown.

closed

public void closed()
Description copied from interface: HttpHeaderListener
The socket connection has been closed, either by this end or the other side. Quite common on persistent connections.

Specified by:
closed in interface HttpHeaderListener

failed

public void failed(Exception cause)
Description copied from interface: AsyncListener
Reading failed

Specified by:
failed in interface AsyncListener
Parameters:
cause - the real reason the operation failed.

timeout

public void timeout()
Description copied from interface: AsyncListener
The operation timed out

Specified by:
timeout in interface AsyncListener