rabbit.proxy
Class HttpHeaderReader

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

public class HttpHeaderReader
extends BaseSocketHandler
implements LineListener

A handler that reads http headers

Author:
Robert Olofsson

Field Summary
 
Fields inherited from class rabbit.proxy.BaseSocketHandler
buffer, channel, logger, selector, sk
 
Constructor Summary
HttpHeaderReader(SocketChannel channel, ByteBuffer buffer, Selector selector, Logger logger, TrafficLogger tl, boolean request, boolean strictHttp, HttpHeaderListener reader)
           
 
Method Summary
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.proxy.BaseSocketHandler
allocateBuffer, closeDown, getLogger, register, 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,
                        ByteBuffer buffer,
                        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

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