rabbit.meta
Class BaseMetaHandler

java.lang.Object
  extended by rabbit.meta.BaseMetaHandler
All Implemented Interfaces:
AsyncListener, BlockSentListener, MetaHandler
Direct Known Subclasses:
CacheStatus, ClearCache, Connections, Kill, SelectorStatus, StackTrace, Status, TaskTimings

public abstract class BaseMetaHandler
extends Object
implements MetaHandler, BlockSentListener

A base class for meta handlers. This meta handler will send a http header that say that the content is chunked. Then

Author:
Robert Olofsson

Nested Class Summary
static class BaseMetaHandler.PageCompletion
           
 
Field Summary
protected  Connection con
           
protected  SProperties htab
           
protected  Logger logger
           
protected  HttpHeader request
           
protected  TrafficLogger tlClient
           
protected  TrafficLogger tlProxy
           
 
Constructor Summary
BaseMetaHandler()
           
 
Method Summary
protected abstract  BaseMetaHandler.PageCompletion addPageInformation(StringBuilder sb)
          Add the page information
 void blockSent()
          The http header has been sent.
protected  void buildAndSendData()
           
protected  void cleanup()
           
protected  void endChunking()
           
 void failed(Exception e)
          Reading failed
protected abstract  String getPageHeader()
          Get the page header name
 void handle(HttpHeader request, SProperties htab, Connection con, TrafficLogger tlProxy, TrafficLogger tlClient)
          Handle a client request.
 void timeout()
          The operation timed out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected HttpHeader request

htab

protected SProperties htab

con

protected Connection con

tlProxy

protected TrafficLogger tlProxy

tlClient

protected TrafficLogger tlClient

logger

protected final Logger logger
Constructor Detail

BaseMetaHandler

public BaseMetaHandler()
Method Detail

handle

public void handle(HttpHeader request,
                   SProperties htab,
                   Connection con,
                   TrafficLogger tlProxy,
                   TrafficLogger tlClient)
            throws IOException
Description copied from interface: MetaHandler
Handle a client request.

Specified by:
handle in interface MetaHandler
Parameters:
request - the http request header.
htab - the supplied argument to the page (CGI-parameters).
con - the Connection that is serving the request.
tlProxy - the TrafficLogger to log proxy traffic on.
tlClient - the TrafficLogger to log client traffic on.
Throws:
IOException

blockSent

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

Specified by:
blockSent in interface BlockSentListener

cleanup

protected void cleanup()
                throws IOException
Throws:
IOException

endChunking

protected void endChunking()
                    throws IOException
Throws:
IOException

buildAndSendData

protected void buildAndSendData()
                         throws IOException
Throws:
IOException

getPageHeader

protected abstract String getPageHeader()
Get the page header name


addPageInformation

protected abstract BaseMetaHandler.PageCompletion addPageInformation(StringBuilder sb)
Add the page information

Parameters:
sb - The page being build.
Returns:
the current status of the page.

failed

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

Specified by:
failed in interface AsyncListener
Parameters:
e - 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