|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rabbit.handler.BaseHandler rabbit.handler.GZipHandler
public class GZipHandler
This handler compresses the data passing through it.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class rabbit.handler.BaseHandler |
---|
BaseHandler.MainBlockListener |
Field Summary | |
---|---|
protected boolean |
compress
|
Fields inherited from class rabbit.handler.BaseHandler |
---|
cacheChannel, clientHandle, con, content, entry, mayCache, mayFilter, request, response, size, tlh, totalRead |
Constructor Summary | |
---|---|
GZipHandler()
For creating the factory. |
|
GZipHandler(Connection con,
TrafficLoggerHandler tlh,
HttpHeader request,
BufferHandle clientHandle,
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(BufferHandle bufHandle)
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,
BufferHandle bufHandle,
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(BufferHandle bufHandle)
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. |
protected void |
send(BufferHandle bufHandle)
|
void |
setup(Logger logger,
SProperties prop)
setup the handler factory. |
protected void |
setupHandler()
|
protected void |
waitForData()
|
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.BaseHandler |
---|
addCache, failed, finish, finishedRead, getLogger, getTaskRunner, 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 boolean compress
Constructor Detail |
---|
public GZipHandler()
public GZipHandler(Connection con, TrafficLoggerHandler tlh, HttpHeader request, BufferHandle clientHandle, HttpHeader response, ResourceSource content, boolean mayCache, boolean mayFilter, long size, boolean compress)
con
- the Connection handling the request.request
- the actual request made.clientHandle
- 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 |
---|
protected void setupHandler()
protected boolean willCompress(HttpHeader request)
public Handler getNewInstance(Connection con, TrafficLoggerHandler tlh, HttpHeader header, BufferHandle bufHandle, 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.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).public boolean changesContentSize()
changesContentSize
in interface Handler
changesContentSize
in class BaseHandler
protected void prepare()
BaseHandler
prepare
in class BaseHandler
protected void finishData()
BaseHandler
finishData
in class BaseHandler
protected boolean mayTransfer()
mayTransfer
in class BaseHandler
public void blockSent()
BlockSentListener
blockSent
in interface BlockSentListener
blockSent
in class BaseHandler
protected void waitForData()
protected void writeDataToGZipper(byte[] arr) throws IOException
arr
- the data to write to the gzip stream.
IOException
protected void modifyBuffer(BufferHandle bufHandle)
bufHandle
- the handle to the buffer that just was read.protected void send(BufferHandle bufHandle)
public void bufferRead(BufferHandle bufHandle)
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 |