rabbit.handler
Class GZIPHandler

java.lang.Object
  extended by rabbit.handler.BaseHandler
      extended by rabbit.handler.GZIPHandler
All Implemented Interfaces:
Handler, HandlerFactory, Logger
Direct Known Subclasses:
FilterHandler

public class GZIPHandler
extends BaseHandler

This class is used to gzip streams.


Field Summary
 
Fields inherited from class rabbit.handler.BaseHandler
cacheStream, clientstream, con, contentstream, entry, maycache, mayfilter, request, response, size
 
Fields inherited from interface rabbit.util.Logger
ALL, DEBUG, ERROR, FATAL, INFO, MSG, WARN
 
Constructor Summary
GZIPHandler()
           
GZIPHandler(Connection con, HTTPHeader request, HTTPHeader response, HTTPInputStream contentstream, MultiOutputStream clientstream, boolean maycache, boolean mayfilter, long size)
          Create a new GZIPHansler for the given request.
 
Method Summary
protected  boolean clientStreamHasCache()
          Check if the client stream also have a cache stream.
protected  void finishStream()
          This method is used to finish the stream for the data being sent.
 Handler getNewInstance(Connection connection, HTTPHeader header, HTTPHeader webheader, HTTPInputStream contentStream, MultiOutputStream out, boolean maycache, boolean mayfilter, long size)
          Get a new Handler for the given request made.
protected  void prepareStream()
          This method is used to prepare the stream for the data being sent.
 void setup(Logger logger, SProperties prop)
          Setup this class.
 
Methods inherited from class rabbit.handler.BaseHandler
addCacheStream, finish, getFactory, handle, logError, logError, mayCacheFromSize, mayRestrictCacheSize, removeCache, send, setPartialContent, writeData, writeHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZIPHandler

public GZIPHandler()

GZIPHandler

public GZIPHandler(Connection con,
                   HTTPHeader request,
                   HTTPHeader response,
                   HTTPInputStream contentstream,
                   MultiOutputStream clientstream,
                   boolean maycache,
                   boolean mayfilter,
                   long size)
Create a new GZIPHansler for the given request.

Parameters:
con - the Connection handling the request.
request - the actual request made.
response - the actual response.
contentstream - the stream to read data from.
clientstream - the stream to write data to.
maycache - May we cache this request?
mayfilter - May we filter this request?
size - the size of the data beeing handled.
Method Detail

getNewInstance

public Handler getNewInstance(Connection connection,
                              HTTPHeader header,
                              HTTPHeader webheader,
                              HTTPInputStream contentStream,
                              MultiOutputStream out,
                              boolean maycache,
                              boolean mayfilter,
                              long size)
Description copied from interface: HandlerFactory
Get a new Handler for the given request made.

Specified by:
getNewInstance in interface HandlerFactory
Overrides:
getNewInstance in class BaseHandler
Parameters:
connection - the Connection handling the request.
header - the request.
webheader - the response.
contentStream - the data to read.
out - the client (and possibly the cache).
maycache - if the handler may cache the response.
mayfilter - if the handler may filter the response.
size - the Size of the data beeing handled (-1 = unknown length).

clientStreamHasCache

protected boolean clientStreamHasCache()
Description copied from class: BaseHandler
Check if the client stream also have a cache stream.

Overrides:
clientStreamHasCache in class BaseHandler

prepareStream

protected void prepareStream()
                      throws java.io.IOException
This method is used to prepare the stream for the data being sent. This method sets the stream up for gzipping.

Overrides:
prepareStream in class BaseHandler
Throws:
java.io.IOException

finishStream

protected void finishStream()
                     throws java.io.IOException
This method is used to finish the stream for the data being sent. This method finishes the gzipping.

Overrides:
finishStream in class BaseHandler
Throws:
java.io.IOException

setup

public void setup(Logger logger,
                  SProperties prop)
Setup this class.

Specified by:
setup in interface HandlerFactory
Overrides:
setup in class BaseHandler
Parameters:
prop - the properties of this class.