Enhydra 5.1 API

org.enhydra.servlet.filter
Class Filter

java.lang.Object
  |
  +--org.enhydra.servlet.filter.Filter
Direct Known Subclasses:
MultiServerFilter, PrintTransactionFilter, ServletRecorderFilter

public abstract class Filter
extends java.lang.Object

This replaces the BasicTransactionFilter. Also note that the BasicTransactionServlet is no longer used and that it is functionally replaced by implementing the org.apache.tomcat.core.LifecycleInterceptor and org.apache.tomcat.core.ServiceInterceptor. There is no interface defined for this, since this is a temporary halfway point between the old Enhydra TransactionFilter and the future Tomcat Interceptors. Extend this class to create a filter with additional attributes. The object model is not currently very clean because we need to bridge between the Interceptor model of Tomcat for service(), init(), and destroy(), while maintaining the Enhydra request and response wrapping (Valve model).

Author:
Shawn McMurdo

Constructor Summary
Filter()
          Default constructor.
Filter(java.lang.String description)
          Constructor given a description only.
 
Method Summary
 java.lang.String getDescription()
          Get the String description for this Filter.
 org.apache.tomcat.core.LifecycleInterceptor getDestroyInterceptor()
          Get the destroy() LifecycleInterceptor for this Filter.
 org.apache.tomcat.core.LifecycleInterceptor getInitInterceptor()
          Get the init() LifecycleInterceptor for this Filter.
 org.apache.tomcat.core.ServiceInterceptor getServiceInterceptor()
          Get the ServiceInterceptor for this Filter.
 void registerInterceptors(java.lang.String id)
          Adds the service, init, and destroy interceptors to the Tomcat Context for the given servlet.
 void setDescription(java.lang.String description)
          Set the String description for this Filter.
 void setDestroyInterceptor(org.apache.tomcat.core.LifecycleInterceptor destroyInterceptor)
          Set the destroy() LifecycleInterceptor for this Filter.
 void setInitInterceptor(org.apache.tomcat.core.LifecycleInterceptor initInterceptor)
          Set the init() LifecycleInterceptor for this Filter.
 void setServiceInterceptor(org.apache.tomcat.core.ServiceInterceptor serviceInterceptor)
          Set the ServiceInterceptor for this Filter.
 java.lang.String toString()
          Override toString since that is what the Admin used to use to get the description.
 void unregisterInterceptors(java.lang.String id)
          Removes the service, init, and destroy interceptors from the Tomcat Context for the given servlet.
 RequestFilter wrapRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the RequestFilter for this Filter by wrapping the given Request.
abstract  ResponseFilter wrapResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the ResponseFilter for this Filter by wrapping the given Response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Default constructor. Other filter elements must be set with the set methods.


Filter

public Filter(java.lang.String description)
Constructor given a description only. Other filter elements must be set with the set methods.

Parameters:
description - a String describing the filter, suitable for a select list.
Method Detail

registerInterceptors

public void registerInterceptors(java.lang.String id)
Adds the service, init, and destroy interceptors to the Tomcat Context for the given servlet.

Parameters:
id - The servlet id used to find the Context.

unregisterInterceptors

public void unregisterInterceptors(java.lang.String id)
Removes the service, init, and destroy interceptors from the Tomcat Context for the given servlet.

Parameters:
id - The servlet id used to find the Context.

setDescription

public void setDescription(java.lang.String description)
Set the String description for this Filter. This should be suitable for display in a select list.

Parameters:
description - is a String describing the filter.

getDescription

public java.lang.String getDescription()
Get the String description for this Filter.

Returns:
a String describing the filter.

toString

public java.lang.String toString()
Override toString since that is what the Admin used to use to get the description.

Overrides:
toString in class java.lang.Object
Returns:
a String describing the filter.

wrapRequest

public RequestFilter wrapRequest(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
Get the RequestFilter for this Filter by wrapping the given Request.

Parameters:
request - an HttpServletRequest to be wrapped by the filter.
response - an HttpServletResponse that is generally not used, but is available for request-response data coordination.
Returns:
a RequestFilter

wrapResponse

public abstract ResponseFilter wrapResponse(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response)
Get the ResponseFilter for this Filter by wrapping the given Response.

Parameters:
request - an HttpServletRequest that is generally not used, but is available for request-response data coordination.
response - an HttpServletResponse to be wrapped by the filter.
Returns:
a ResponseFilter

setServiceInterceptor

public void setServiceInterceptor(org.apache.tomcat.core.ServiceInterceptor serviceInterceptor)
Set the ServiceInterceptor for this Filter.

Parameters:
serviceInterceptor - is a ServiceInterceptor

getServiceInterceptor

public org.apache.tomcat.core.ServiceInterceptor getServiceInterceptor()
Get the ServiceInterceptor for this Filter.

Returns:
a ServiceInterceptor

setInitInterceptor

public void setInitInterceptor(org.apache.tomcat.core.LifecycleInterceptor initInterceptor)
Set the init() LifecycleInterceptor for this Filter.

Parameters:
initInterceptor - is a LifecycleInterceptor for init()

getInitInterceptor

public org.apache.tomcat.core.LifecycleInterceptor getInitInterceptor()
Get the init() LifecycleInterceptor for this Filter.

Returns:
a LifecycleInterceptor for init()

setDestroyInterceptor

public void setDestroyInterceptor(org.apache.tomcat.core.LifecycleInterceptor destroyInterceptor)
Set the destroy() LifecycleInterceptor for this Filter.

Parameters:
destroyInterceptor - is a LifecycleInterceptor for destroy()

getDestroyInterceptor

public org.apache.tomcat.core.LifecycleInterceptor getDestroyInterceptor()
Get the destroy() LifecycleInterceptor for this Filter.

Returns:
a LifecycleInterceptor for destroy()

Enhydra 5.1 API