FilterHandler (RabbIT/4)
Date: 2009-12-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.handler
Class FilterHandler

    java.lang.Object
      rabbit.handler.BaseHandler
          rabbit.handler.GZipHandler
              rabbit.handler.FilterHandler

All Implemented Interfaces:
  Handler, HandlerFactory, AsyncListener, BlockListener, BlockSentListener, HttpHeaderSentListener

    public class FilterHandler

extends GZipHandler

This handler filters out unwanted html features.

Author:
  Robert Olofsson

Field Summary

Fields inherited from class rabbit.handler.GZipHandler
`compress`

Fields inherited from class rabbit.handler.BaseHandler
`cacheChannel, clientHandle, con, content, entry, mayCache, mayFilter, request, response, size, tlh, totalRead`

Constructor Summary
`FilterHandler()`
`FilterHandler(Connection con, TrafficLoggerHandler tlh, HttpHeader request, BufferHandle clientHandle, HttpHeader response, ResourceSource content, boolean mayCache, boolean mayFilter, long size, boolean compress, boolean repack, List<HtmlFilterFactory> filterClasses)` Create a new FilterHandler for the given request.

Method Summary
`void` | `blockSent()` The http header has been sent.
`protected void` | `finishData()` This method is used to finish the data for the resource being sent.
`Handler` | `getNewInstance(Connection con, TrafficLoggerHandler tlh, HttpHeader header, BufferHandle bufHandle, HttpHeader webHeader, ResourceSource content, boolean mayCache, boolean mayFilter, long size)` Get a new Handler for the given request made.
`protected void` | `modifyBuffer(BufferHandle bufHandle)` This method is used when we are not compressing data.
`void` | `setup(SProperties prop)` Setup this class.
`protected void` | `setupHandler()`
`protected boolean` | `willCompress(HttpHeader request)`
`protected void` | `writeDataToGZipper(byte[] arr)` Write the current block of data to the gzipper.

Methods inherited from class rabbit.handler.GZipHandler
`bufferRead, changesContentSize, mayTransfer, prepare, send, waitForData`

Methods inherited from class rabbit.handler.BaseHandler
`addCache, deleteFile, failed, finish, finishedRead, getLogger, handle, httpHeaderSent, mayCacheFromSize, mayRestrictCacheSize, prepareStream, removeCache, send, sendHeader, setPartialContent, timeout, writeCache`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FilterHandler

    public FilterHandler()

### FilterHandler

    public FilterHandler(Connection con,
                         TrafficLoggerHandler tlh,
                         HttpHeader request,
                         BufferHandle clientHandle,
                         HttpHeader response,
                         ResourceSource content,
                         boolean mayCache,
                         boolean mayFilter,
                         long size,
                         boolean compress,
                         boolean repack,
                         List<HtmlFilterFactory> filterClasses)

  Create a new FilterHandler for the given request.

  Parameters:
    `con` - the Connection handling the request.
    `request` - the actual request made.
    `clientHandle` - the client side buffer handle.
    `response` - the actual response.
    `content` - the resource.
    `mayCache` - May we cache this request?
    `mayFilter` - May we filter this request?
    `size` - the size of the data beeing handled.
    `compress` - if we want this handler to compress or not.

Method Detail

### setupHandler

    protected void setupHandler()

  Overrides:
    `setupHandler` in class `GZipHandler`

### willCompress

    protected boolean willCompress(HttpHeader request)

  Overrides:
    `willCompress` in class `GZipHandler`

### getNewInstance

    public Handler getNewInstance(Connection con,
                                  TrafficLoggerHandler tlh,
                                  HttpHeader header,
                                  BufferHandle bufHandle,
                                  HttpHeader webHeader,
                                  ResourceSource content,
                                  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 `GZipHandler`
  Parameters:
    `con` - the Connection handling the request.
    `tlh` - the Traffic logger handler.
    `header` - the request.
    `bufHandle` - the client side buffer handle (may contain the next request).
    `webHeader` - the response.
    `content` - the resource.
    `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).

### writeDataToGZipper

    protected void writeDataToGZipper(byte[] arr)

  Description copied from class: `GZipHandler`
  Write the current block of data to the gzipper. If you override this method you probably want to override the modifyBuffer(ByteBuffer) as well.

  Overrides:
    `writeDataToGZipper` in class `GZipHandler`
  Parameters:
    `arr` - the data to write to the gzip stream.

### modifyBuffer

    protected void modifyBuffer(BufferHandle bufHandle)

  Description copied from class: `GZipHandler`
  This method is used when we are not compressing data. This method will just call "super.bufferRead (buf);"

  Overrides:
    `modifyBuffer` in class `GZipHandler`
  Parameters:
    `bufHandle` - the handle to the buffer that just was read.

### blockSent

    public void blockSent()

  Description copied from interface: `BlockSentListener`
  The http header has been sent.

  Specified by:
    `blockSent` in interface `BlockSentListener`
  Overrides:
    `blockSent` in class `GZipHandler`

### finishData

    protected void finishData()

  Description copied from class: `BaseHandler`
  This method is used to finish the data for the resource being sent. This method will send an end chunk if needed and then call finish

  Overrides:
    `finishData` in class `GZipHandler`

### setup

    public void setup(SProperties prop)

  Setup this class.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD