|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.filter.GenericFilterBean
public abstract class GenericFilterBean
Simple base implementation of javax.servlet.Filter
that treats
its config parameters as bean properties. Unknown parameters are ignored.
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, which have to
implement Filter's doFilter
method.
This filter superclass has no dependency on a Spring application context. Filters usually don't load their own context but rather access beans from the root application context, accessible via the ServletContext.
addRequiredProperty(java.lang.String)
,
initFilterBean()
,
Filter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
,
WebApplicationContextUtils.getWebApplicationContext(javax.servlet.ServletContext)
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
GenericFilterBean()
|
Method Summary | |
---|---|
protected void |
addRequiredProperty(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. |
FilterConfig |
getFilterConfig()
Make the FilterConfig of this filter available. |
protected String |
getFilterName()
Make the name of this filter available to subclasses. |
protected ServletContext |
getServletContext()
Make the ServletContext of this filter available to subclasses. |
void |
init(FilterConfig filterConfig)
Map config parameters onto bean properties of this filter, and invoke subclass initialization. |
protected void |
initBeanWrapper(BeanWrapper bw)
Initialize the BeanWrapper for this GenericFilterBean, possibly with custom editors. |
protected void |
initFilterBean()
Subclasses may override this to perform custom initialization. |
void |
setFilterConfig(FilterConfig filterConfig)
Alternative way of initializing this filter. |
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 |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public GenericFilterBean()
Method Detail |
---|
protected final void addRequiredProperty(String property)
property
- name of the required propertypublic final void setFilterConfig(FilterConfig filterConfig)
filterConfig
- the configuration for this filter
FatalBeanException
- wrapping a ServletException
thrown by the init methodinit(javax.servlet.FilterConfig)
public final void init(FilterConfig filterConfig) throws ServletException
init
in interface Filter
filterConfig
- the configuration for this filter
ServletException
- if bean properties are invalid (or required
properties are missing), or if subclass initialization fails.initFilterBean()
protected void initBeanWrapper(BeanWrapper bw) throws BeansException
bw
- the BeanWrapper to initialize
BeansException
- if thrown by BeanWrapper methodsPropertyEditorRegistry.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor)
public final FilterConfig getFilterConfig()
Public to resemble the getFilterConfig method of the Servlet Filter version that shipped with WebLogic 6.1.
GenericServlet.getServletConfig()
protected final String getFilterName()
GenericServlet.getServletName()
protected final ServletContext getServletContext()
GenericServlet.getServletContext()
protected void initFilterBean() throws ServletException
ServletException
- if subclass initialization failspublic void destroy()
destroy
in interface Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |