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

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by org.norther.tammi.spray.filter.chain.ServletRequestWrapper
All Implemented Interfaces:
EventListener, ServletRequest, Poolable, Recyclable, FilterChainListener
Direct Known Subclasses:
AbstractConnectorRequest, HttpServletRequestWrapper

public class ServletRequestWrapper
extends ServletRequestWrapper
implements FilterChainListener, Poolable

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

Author:
Ilkka Priha

Constructor Summary
ServletRequestWrapper()
          Constructs a new wrapper with a request.
ServletRequestWrapper(ServletRequest req)
          Constructs a new wrapper with a request.
 
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(ServletRequest req)
          Recycles a wrapper with a request.
 void recycled(MBeanReference instance)
          A callback specifying the pool, from which this instance was recycled.
protected  void setExtension(String key, Extension impl)
          Sets the specified extension.
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletRequestWrapper

public ServletRequestWrapper()
Constructs a new wrapper with a request.

Parameters:
req - the wrapped request.

ServletRequestWrapper

public ServletRequestWrapper(ServletRequest req)
Constructs a new wrapper with a request.

Parameters:
req - the wrapped request.
Method Detail

recycle

public void recycle(ServletRequest req)
Recycles a wrapper with a request.

Parameters:
req - the wrapped request.

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 if not available.

setExtension

protected void setExtension(String key,
                            Extension impl)
Sets the specified extension.

Parameters:
key - the extension key.
impl - the extension implementation.

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.