rabbit.httpio
Class HttpHeaderReader

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

public class HttpHeaderReader
extends BaseSocketHandler
implements LineListener

A handler that reads http headers

Author:
Robert Olofsson

Field Summary
 
Fields inherited from class rabbit.httpio.BaseSocketHandler
bh, channel, logger, selector, sk
 
Constructor Summary
HttpHeaderReader(SocketChannel channel, BufferHandle bh, Selector selector, Logger logger, TrafficLogger tl, boolean request, boolean strictHttp, HttpHeaderListener reader)
           
 
Method Summary
 String getDescription()
          Get a string description.
protected  int getSocketOperations()
           
 void lineRead(String line)
          Handle a newly read line.
 void readHeader(String msg)
           
 void run()
           
 void timeout()
          Signal that the select operation timed out.
 
Methods inherited from class rabbit.httpio.BaseSocketHandler
closeDown, getBuffer, getLogger, growBuffer, register, releaseBuffer, unregister, useSeparateThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpHeaderReader

public HttpHeaderReader(SocketChannel channel,
                        BufferHandle bh,
                        Selector selector,
                        Logger logger,
                        TrafficLogger tl,
                        boolean request,
                        boolean strictHttp,
                        HttpHeaderListener reader)
                 throws IOException
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.
Throws:
IOException
Method Detail

getDescription

public String getDescription()
Description copied from interface: SocketHandler
Get a string description.

Specified by:
getDescription in interface SocketHandler

timeout

public void timeout()
Description copied from interface: SocketHandler
Signal that the select operation timed out.

Specified by:
timeout in interface SocketHandler

run

public void run()
Specified by:
run in interface Runnable

getSocketOperations

protected int getSocketOperations()
Specified by:
getSocketOperations in class BaseSocketHandler

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