org.norther.tammi.spray.filter.chain
Class ServletResponseWrapper

java.lang.Object
  extended by javax.servlet.ServletResponseWrapper
      extended by org.norther.tammi.spray.filter.chain.ServletResponseWrapper
All Implemented Interfaces:
EventListener, ServletResponse, Poolable, Recyclable, FilterChainListener
Direct Known Subclasses:
AbstractConnectorResponse, HttpRelayResponse, HttpServletResponseWrapper

public class ServletResponseWrapper
extends ServletResponseWrapper
implements FilterChainListener, Poolable

A wrapper implementation of the javax.servlet.ServletResponse interface providing a recyclable alternative to the javax.servlet.ServletResponseWrapper class. By default, it passes all method calls to the wrapped implementation of the interface.

Author:
Ilkka Priha

Constructor Summary
ServletResponseWrapper()
          Contstructs a new wrapper.
ServletResponseWrapper(ServletResponse res)
          Constructs a new wrapper with a response.
 
Method Summary
 void completed(FilterChainEvent event)
          Notifies the object that a filter chain has completed.
 void dispose()
          Disposes the object after use.
 void disposed()
          A call back indicating that this instance is not needed any more and can be disposed.
 void filtered(FilterChainEvent event)
          Notifies the object that it has been activated within a filter chain.
protected  Extension getExtension(String key)
          Gets the specified extension.
protected  HttpFilterChain getFilterChain()
          Gets the filter chain.
protected  ServletRequest getFilteredRequest()
          Gets the filtered request.
protected  ServletResponse getFilteredResponse()
          Gets the filtered response.
 boolean isDisposed()
          Checks whether the recyclable has been disposed.
 void recycle()
          Recycles the object for a new client.
 void recycle(ServletResponse res)
          Recycles a wrapper with a response.
 void recycled(MBeanReference instance)
          A callback specifying the pool, from which this instance was recycled.
 
Methods inherited from class javax.servlet.ServletResponseWrapper
flushBuffer, getBufferSize, getCharacterEncoding, getContentType, getLocale, getOutputStream, getResponse, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setLocale, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletResponseWrapper

public ServletResponseWrapper()
Contstructs a new wrapper.


ServletResponseWrapper

public ServletResponseWrapper(ServletResponse res)
Constructs a new wrapper with a response.

Parameters:
res - the wrapped response.
Method Detail

recycle

public void recycle(ServletResponse res)
Recycles a wrapper with a response.

Parameters:
res - the wrapped response.

recycle

public void recycle()
Description copied from interface: Recyclable
Recycles the object for a new client. Recycle methods with parameters must be added to implementing object and they will be automatically called by pool implementations when the object is taken from the pool for a new client. The parameters must correspond to the parameters of the constructors of the object. For new objects, constructors can call their corresponding recycle methods whenever applicable. The recycle methods must call their super.

Specified by:
recycle in interface Recyclable

dispose

public void dispose()
Description copied from interface: Recyclable
Disposes the object after use. The method is called when the object is returned to its pool. The dispose method must call its super.

Specified by:
dispose in interface Recyclable

isDisposed

public boolean isDisposed()
Description copied from interface: Recyclable
Checks whether the recyclable has been disposed.

Specified by:
isDisposed in interface Recyclable
Returns:
true, if the recyclable is disposed.

recycled

public void recycled(MBeanReference instance)
Description copied from interface: Poolable
A callback specifying the pool, from which this instance was recycled.

Specified by:
recycled in interface Poolable
Parameters:
instance - the pool MBean reference.

disposed

public void disposed()
Description copied from interface: Poolable
A call back indicating that this instance is not needed any more and can be disposed.

Specified by:
disposed in interface Poolable

filtered

public void filtered(FilterChainEvent event)
Description copied from interface: FilterChainListener
Notifies the object that it has been activated within a filter chain.

Specified by:
filtered in interface FilterChainListener
Parameters:
event - the filter chain event.

completed

public void completed(FilterChainEvent event)
Description copied from interface: FilterChainListener
Notifies the object that a filter chain has completed.

Specified by:
completed in interface FilterChainListener
Parameters:
event - the filter chain event.

getExtension

protected Extension getExtension(String key)
Gets the specified extension.

Parameters:
key - the extension key.
Returns:
the extension or null.

getFilterChain

protected HttpFilterChain getFilterChain()
Gets the filter chain.

Returns:
the filter chain.
Throws:
IllegalStateException - if not filtered.

getFilteredRequest

protected ServletRequest getFilteredRequest()
Gets the filtered request.

Returns:
the filtered request.
Throws:
IllegalStateException - if not filtered.

getFilteredResponse

protected ServletResponse getFilteredResponse()
Gets the filtered response.

Returns:
the filtered response.
Throws:
IllegalStateException - if not filtered.


Copyright © 2004 The Norther Organization. All rights reserved.