rabbit.httpio
Class HttpHeaderReader

java.lang.Object
  extended by rabbit.httpio.BaseSocketHandler
      extended by rabbit.httpio.HttpHeaderReader
All Implemented Interfaces:
ReadHandler, SocketChannelHandler, LineListener

public class HttpHeaderReader
extends BaseSocketHandler
implements LineListener, ReadHandler

A handler that reads http headers

Author:
Robert Olofsson

Constructor Summary
HttpHeaderReader(SocketChannel channel, BufferHandle bh, NioHandler nioHandler, TrafficLogger tl, boolean request, boolean strictHttp, HttpHeaderListener reader)
           
 
Method Summary
 void closed()
          Does nothing by default
 String getDescription()
           
 void lineRead(String line)
          Handle a newly read line.
 void read()
           
 void readHeader(String msg)
           
 void readRequest()
           
 void timeout()
          Does nothing by default
 
Methods inherited from class rabbit.httpio.BaseSocketHandler
closeDown, getBuffer, getBufferHandle, getChannel, getLogger, getTimeout, releaseBuffer, useSeparateThread, waitForRead, waitForWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.khelekore.rnio.SocketChannelHandler
getTimeout, useSeparateThread
 

Constructor Detail

HttpHeaderReader

public HttpHeaderReader(SocketChannel channel,
                        BufferHandle bh,
                        NioHandler nioHandler,
                        TrafficLogger tl,
                        boolean request,
                        boolean strictHttp,
                        HttpHeaderListener reader)
Parameters:
request - true if a request is read, false if a response is read. Servers may respond without header (HTTP/0.9) so try to handle that.
Method Detail

readRequest

public void readRequest()
                 throws IOException
Throws:
IOException

getDescription

public String getDescription()
Specified by:
getDescription in interface SocketChannelHandler
Overrides:
getDescription in class BaseSocketHandler

closed

public void closed()
Description copied from class: BaseSocketHandler
Does nothing by default

Specified by:
closed in interface SocketChannelHandler
Overrides:
closed in class BaseSocketHandler

timeout

public void timeout()
Description copied from class: BaseSocketHandler
Does nothing by default

Specified by:
timeout in interface SocketChannelHandler
Overrides:
timeout in class BaseSocketHandler

read

public void read()
Specified by:
read in interface ReadHandler

lineRead

public void lineRead(String line)
              throws IOException
Handle a newly read line.

Specified by:
lineRead in interface LineListener
Parameters:
line - the line of text that have been read.
Throws:
IOException

readHeader

public void readHeader(String msg)
                throws IOException
Throws:
IOException