rabbit.handler
Class MultiPartHandler

java.lang.Object
  extended by rabbit.handler.BaseHandler
      extended by rabbit.handler.MultiPartHandler
All Implemented Interfaces:
Handler, HandlerFactory, AsyncListener, BlockListener, BlockSentListener, HttpHeaderSentListener

public class MultiPartHandler
extends BaseHandler

This class handles multipart responses, this handler does not filter the resource.

Author:
Robert Olofsson

Field Summary
 
Fields inherited from class rabbit.handler.BaseHandler
cacheChannel, clientHandle, con, content, entry, mayCache, mayFilter, request, response, size, tlh, totalRead
 
Constructor Summary
MultiPartHandler()
           
MultiPartHandler(Connection con, TrafficLoggerHandler tlh, HttpHeader request, BufferHandle clientHandle, HttpHeader response, ResourceSource content)
          Create a new BaseHansler for the given request.
 
Method Summary
 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()
          We may remove trailers, so we may modify the content.
 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 send()
           
 
Methods inherited from class rabbit.handler.BaseHandler
addCache, blockSent, deleteFile, failed, finish, finishData, finishedRead, getLogger, handle, httpHeaderSent, mayCacheFromSize, mayRestrictCacheSize, mayTransfer, prepare, prepareStream, removeCache, sendHeader, setPartialContent, setup, timeout, writeCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPartHandler

public MultiPartHandler()

MultiPartHandler

public MultiPartHandler(Connection con,
                        TrafficLoggerHandler tlh,
                        HttpHeader request,
                        BufferHandle clientHandle,
                        HttpHeader response,
                        ResourceSource content)
Create a new BaseHansler for the given request.

Parameters:
con - the Connection handling the request.
request - the actual request made.
clientHandle - the client side buffer.
response - the actual response.
content - the resource.
Method Detail

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 BaseHandler
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).

changesContentSize

public boolean changesContentSize()
We may remove trailers, so we may modify the content. ®return true this handler modifies the content.

Specified by:
changesContentSize in interface Handler
Overrides:
changesContentSize in class BaseHandler
Returns:
true if Content-Lenght may be changed by this handler typically used for handlers that may modify the content. Return false if this handler will not change the size.

send

protected void send()
Overrides:
send in class BaseHandler

bufferRead

public void bufferRead(BufferHandle bufHandle)
Description copied from interface: BlockListener
A buffer has been read, the buffer has been flip:ed before this call is made so position and remaining are valid.

Specified by:
bufferRead in interface BlockListener
Overrides:
bufferRead in class BaseHandler