|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.handler.BaseHandler
rabbit.handler.GZipHandler
public class GZipHandler
This handler compresses the data passing through it.
Nested Class Summary | |
---|---|
protected class |
GZipHandler.GZStream2Channel
|
protected class |
GZipHandler.Stream2Channel
|
Field Summary | |
---|---|
protected boolean |
compress
|
protected GZIPOutputStream |
gz
|
Fields inherited from class rabbit.handler.BaseHandler |
---|
cacheChannel, clientBuffer, con, content, entry, mayCache, mayFilter, request, response, size, tlh, totalRead |
Constructor Summary | |
---|---|
GZipHandler()
For creating the factory. |
|
GZipHandler(Connection con,
TrafficLoggerHandler tlh,
HttpHeader request,
ByteBuffer clientBuffer,
HttpHeader response,
ResourceSource content,
boolean mayCache,
boolean mayFilter,
long size,
boolean compress)
Create a new GZipHandler for the given request. |
Method Summary | |
---|---|
void |
blockSent()
The http header has been sent. |
void |
bufferRead(ByteBuffer buf)
A buffer has been read, the buffer has been flip:ed before this call is made so position and remaining are valid. |
boolean |
changesContentSize()
®return true this handler modifies the content. |
protected void |
finishData()
This method is used to finish the data for the resource being sent. |
Handler |
getNewInstance(Connection con,
TrafficLoggerHandler tlh,
HttpHeader header,
ByteBuffer buffer,
HttpHeader webHeader,
ResourceSource content,
boolean mayCache,
boolean mayFilter,
long size)
Get a new Handler for the given request made. |
protected boolean |
mayTransfer()
Check if this handler supports direct transfers. |
protected void |
modifyBuffer(ByteBuffer buf)
This method is used when we are not compressing data. |
protected void |
prepare()
This method is used to prepare the data for the resource being sent. |
void |
setup(Logger logger,
SProperties prop)
setup the handler factory. |
protected void |
writeDataToGZipper(byte[] arr)
Write the current block of data to the gzipper. |
Methods inherited from class rabbit.handler.BaseHandler |
---|
addCache, 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 |
Field Detail |
---|
protected GZIPOutputStream gz
protected boolean compress
Constructor Detail |
---|
public GZipHandler()
public GZipHandler(Connection con, TrafficLoggerHandler tlh, HttpHeader request, ByteBuffer clientBuffer, HttpHeader response, ResourceSource content, boolean mayCache, boolean mayFilter, long size, boolean compress)
con
- the Connection handling the request.request
- the actual request made.clientBuffer
- the client side buffer.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 |
---|
public Handler getNewInstance(Connection con, TrafficLoggerHandler tlh, HttpHeader header, ByteBuffer buffer, HttpHeader webHeader, ResourceSource content, boolean mayCache, boolean mayFilter, long size)
HandlerFactory
getNewInstance
in interface HandlerFactory
getNewInstance
in class BaseHandler
con
- the Connection handling the request.tlh
- the Traffic logger handler.header
- the request.buffer
- the client side buffer (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).public boolean changesContentSize()
changesContentSize
in interface Handler
changesContentSize
in class BaseHandler
protected void prepare() throws IOException
BaseHandler
prepare
in class BaseHandler
IOException
protected void finishData() throws IOException
BaseHandler
finishData
in class BaseHandler
IOException
protected boolean mayTransfer()
mayTransfer
in class BaseHandler
public void blockSent()
BlockSentListener
blockSent
in interface BlockSentListener
blockSent
in class BaseHandler
protected void writeDataToGZipper(byte[] arr) throws IOException
arr
- the data to write to the gzip stream.
IOException
protected void modifyBuffer(ByteBuffer buf)
buf
- the buffer that was just read.public void bufferRead(ByteBuffer buf)
BlockListener
bufferRead
in interface BlockListener
bufferRead
in class BaseHandler
public void setup(Logger logger, SProperties prop)
HandlerFactory
setup
in interface HandlerFactory
setup
in class BaseHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |