org.springframework.web.filter
Class GenericFilterBean

java.lang.Object
  extended byorg.springframework.web.filter.GenericFilterBean
All Implemented Interfaces:
javax.servlet.Filter
Direct Known Subclasses:
OncePerRequestFilter

public abstract class GenericFilterBean
extends java.lang.Object
implements javax.servlet.Filter

Simple base implementation of javax.servlet.Filter that treats its config parameters as bean properties. A very handy superclass for any type of filter. Type conversion is automatic. It is also possible for subclasses to specify required properties.

This filter leaves actual filtering to subclasses.

Since:
06.12.2003
Author:
Juergen Hoeller
See Also:
initFilterBean()

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
GenericFilterBean()
           
 
Method Summary
protected  void addRequiredProperty(java.lang.String property)
          Subclasses can invoke this method to specify that this property (which must match a JavaBean property they expose) is mandatory, and must be supplied as a config parameter.
 void destroy()
          Subclasses may override this to perform custom filter shutdown.
protected  javax.servlet.FilterConfig getFilterConfig()
          Make the FilterConfig of this filter available to subclasses.
protected  java.lang.String getFilterName()
          Make the name of this filter available to subclasses.
protected  javax.servlet.ServletContext getServletContext()
          Make the ServletContext of this filter available to subclasses.
 void init(javax.servlet.FilterConfig filterConfig)
          Map config parameters onto bean properties of this filter, and invoke subclass initialization.
protected  void initFilterBean()
          Subclasses may override this to perform custom initialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.Filter
doFilter
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

GenericFilterBean

public GenericFilterBean()
Method Detail

addRequiredProperty

protected final void addRequiredProperty(java.lang.String property)
Subclasses can invoke this method to specify that this property (which must match a JavaBean property they expose) is mandatory, and must be supplied as a config parameter.

Parameters:
property - name of the required property

init

public final void init(javax.servlet.FilterConfig filterConfig)
                throws javax.servlet.ServletException
Map config parameters onto bean properties of this filter, and invoke subclass initialization.

Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException - if bean properties are invalid (or required properties are missing), or if subclass initialization fails.
See Also:
initFilterBean()

getFilterConfig

protected final javax.servlet.FilterConfig getFilterConfig()
Make the FilterConfig of this filter available to subclasses. Analogous to GenericServlet's getServletConfig.

See Also:
GenericServlet.getServletConfig()

getFilterName

protected final java.lang.String getFilterName()
Make the name of this filter available to subclasses. Analogous to GenericServlet's getServletName.

See Also:
GenericServlet.getServletName()

getServletContext

protected final javax.servlet.ServletContext getServletContext()
Make the ServletContext of this filter available to subclasses. Analogous to GenericServlet's getServletContext.

See Also:
GenericServlet.getServletContext()

initFilterBean

protected void initFilterBean()
                       throws javax.servlet.ServletException
Subclasses may override this to perform custom initialization. All bean properties of this servlet will have been set before this method is invoked. This default implementation does nothing.

Throws:
javax.servlet.ServletException - if subclass initialization fails

destroy

public void destroy()
Subclasses may override this to perform custom filter shutdown. This default implementation does nothing.

Specified by:
destroy in interface javax.servlet.Filter


Copyright (C) 2003-2004 The Spring Framework Project.