rabbit.httpio
Class HttpHeaderReader
java.lang.Object
rabbit.httpio.BaseSocketHandler
rabbit.httpio.HttpHeaderReader
- All Implemented Interfaces:
- ReadHandler, SocketChannelHandler
public class HttpHeaderReader
- extends BaseSocketHandler
- implements ReadHandler
A handler that reads http headers
- Author:
- Robert Olofsson
| Methods inherited from class rabbit.httpio.BaseSocketHandler |
closeDown, getBuffer, getBufferHandle, getChannel, getLargeBuffer, getLogger, getTimeout, isUsingSmallBuffer, releaseBuffer, useSeparateThread, waitForRead, waitForWrite |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpHeaderReader
public HttpHeaderReader(java.nio.channels.SocketChannel channel,
BufferHandle bh,
NioHandler nioHandler,
TrafficLogger tl,
boolean request,
boolean strictHttp,
HttpHeaderListener reader)
- Parameters:
channel - the SocketChannel to read frombh - the BufferHandle to use to get ByteBuffersnioHandler - the NioHandler to use to wait for more datatl - the TrafficLogger to update with network read Statisticsrequest - 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.strictHttp - if true http headers will be strictly parsed, if false
http newlines may be single \nreader - the listener for http headers
readHeader
public void readHeader()
throws java.io.IOException
- Try to read a http header
- Throws:
java.io.IOException - if a header can not be parsed
getDescription
public java.lang.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