|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.springframework.web.portlet.filter.GenericPortletFilterBean
public abstract class GenericPortletFilterBean
Simple base implementation of ActionFilter, EventFilter,
RenderFilter, and ResourceFilter which treats its config
parameters (init-param entries within the filter
tag in portlet.xml) as bean properties.
A handy superclass for any type of filter. Type conversion of config parameters is automatic, with the corresponding setter method getting invoked with the converted value. It is also possible for subclasses to specify required properties. Parameters without matching bean property setter will simply be ignored.
This filter leaves actual filtering to subclasses, which have to
override the doFilter method(s) the correspond to the portlet
filter interface(s) being used.
This generic filter base class has no dependency on the Spring
ApplicationContext concept.
Filters usually don't load their own context but rather access service
beans from the Spring root application context, accessible via the
filter's PortletContext (see
PortletApplicationContextUtils2).
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses |
| Constructor Summary | |
|---|---|
GenericPortletFilterBean()
|
|
| 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 |
afterPropertiesSet()
Calls the initFilterBean() method that might
contain custom initialization of a subclass. |
void |
destroy()
Subclasses may override this to perform custom filter shutdown. |
protected void |
doCommonFilter(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
javax.portlet.filter.FilterChain chain)
Can be implemented by subclasses to provide filter handling common to all request types. |
void |
doFilter(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response,
javax.portlet.filter.FilterChain chain)
Calls doCommonFilter(PortletRequest, PortletResponse, FilterChain) |
void |
doFilter(javax.portlet.EventRequest request,
javax.portlet.EventResponse response,
javax.portlet.filter.FilterChain chain)
Calls doCommonFilter(PortletRequest, PortletResponse, FilterChain) |
void |
doFilter(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response,
javax.portlet.filter.FilterChain chain)
Calls doCommonFilter(PortletRequest, PortletResponse, FilterChain) |
void |
doFilter(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response,
javax.portlet.filter.FilterChain chain)
Calls doCommonFilter(PortletRequest, PortletResponse, FilterChain) |
javax.portlet.filter.FilterConfig |
getFilterConfig()
Make the FilterConfig of this filter available, if any. |
protected String |
getFilterName()
Make the name of this filter available to subclasses. |
protected javax.portlet.PortletContext |
getPortletContext()
Make the PortletContext of this filter available to subclasses. |
void |
init(javax.portlet.filter.FilterConfig filterConfig)
|
protected void |
initBeanWrapper(org.springframework.beans.BeanWrapper bw)
Initialize the BeanWrapper for this GenericPortletFilterBean, possibly with custom editors. |
protected void |
initFilterBean()
Subclasses may override this to perform custom initialization. |
void |
setBeanName(String beanName)
Stores the bean name as defined in the Spring bean factory. |
void |
setEnvironment(org.springframework.core.env.Environment environment)
|
void |
setPortletContext(javax.portlet.PortletContext portletContext)
Stores the PortletContext that the bean factory runs in. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public GenericPortletFilterBean()
| Method Detail |
|---|
public final void setBeanName(String beanName)
Only relevant in case of initialization as bean, to have a name as fallback to the filter name usually provided by a FilterConfig instance.
setBeanName in interface org.springframework.beans.factory.BeanNameAwareBeanNameAware,
getFilterName()public void setEnvironment(org.springframework.core.env.Environment environment)
Any environment set here overrides the StandardPortletEnvironment
provided by default.
This Environment object is used only for resolving placeholders in
resource paths passed into init-parameters for this filter. If no init-params are
used, this Environment can be essentially ignored.
setEnvironment in interface org.springframework.context.EnvironmentAwareinit(FilterConfig)public final void setPortletContext(javax.portlet.PortletContext portletContext)
Only relevant in case of initialization as bean, to have a PortletContext as fallback to the context usually provided by a FilterConfig instance.
setPortletContext in interface org.springframework.web.portlet.context.PortletContextAwarePortletContextAware,
getPortletContext()
public void afterPropertiesSet()
throws Exception
initFilterBean() method that might
contain custom initialization of a subclass.
Only relevant in case of initialization as bean, where the
standard init(FilterConfig) method won't be called.
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptioninitFilterBean(),
init(FilterConfig)protected final void addRequiredProperty(String property)
This method is only relevant in case of traditional initialization driven by a FilterConfig instance.
property - name of the required property
public void init(javax.portlet.filter.FilterConfig filterConfig)
throws javax.portlet.PortletException
init in interface javax.portlet.filter.PortletFilterjavax.portlet.PortletException
protected void initBeanWrapper(org.springframework.beans.BeanWrapper bw)
throws org.springframework.beans.BeansException
This default implementation is empty.
bw - the BeanWrapper to initialize
org.springframework.beans.BeansException - if thrown by BeanWrapper methodsPropertyEditorRegistry.registerCustomEditor(java.lang.Class>, java.beans.PropertyEditor)public final javax.portlet.filter.FilterConfig getFilterConfig()
getPortletConfig().
Public to resemble the getFilterConfig() method
of the Portlet Filter version that shipped with WebLogic 6.1.
null if none availableGenericPortlet.getPortletConfig()protected final String getFilterName()
getPortletName().
Takes the FilterConfig's filter name by default. If initialized as bean in a Spring application context, it falls back to the bean name as defined in the bean factory.
null if none availableGenericPortlet.getPortletName(),
FilterConfig.getFilterName(),
setBeanName(java.lang.String)protected final javax.portlet.PortletContext getPortletContext()
getPortletContext().
Takes the FilterConfig's PortletContext by default. If initialized as bean in a Spring application context, it falls back to the PortletContext that the bean factory runs in.
null if none availableGenericPortlet.getPortletContext(),
javax.portlet.FilterConfig#getPortletContext(),
setPortletContext(javax.portlet.PortletContext)
protected void initFilterBean()
throws javax.portlet.PortletException
Note: This method will be called from standard filter initialization as well as filter bean initialization in a Spring application context. Filter name and PortletContext will be available in both cases.
This default implementation is empty.
javax.portlet.PortletException - if subclass initialization failsgetFilterName(),
getPortletContext()
public void doFilter(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response,
javax.portlet.filter.FilterChain chain)
throws IOException,
javax.portlet.PortletException
doCommonFilter(PortletRequest, PortletResponse, FilterChain)
doFilter in interface javax.portlet.filter.ActionFilterIOException
javax.portlet.PortletException
public void doFilter(javax.portlet.EventRequest request,
javax.portlet.EventResponse response,
javax.portlet.filter.FilterChain chain)
throws IOException,
javax.portlet.PortletException
doCommonFilter(PortletRequest, PortletResponse, FilterChain)
doFilter in interface javax.portlet.filter.EventFilterIOException
javax.portlet.PortletException
public void doFilter(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response,
javax.portlet.filter.FilterChain chain)
throws IOException,
javax.portlet.PortletException
doCommonFilter(PortletRequest, PortletResponse, FilterChain)
doFilter in interface javax.portlet.filter.ResourceFilterIOException
javax.portlet.PortletException
public void doFilter(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response,
javax.portlet.filter.FilterChain chain)
throws IOException,
javax.portlet.PortletException
doCommonFilter(PortletRequest, PortletResponse, FilterChain)
doFilter in interface javax.portlet.filter.RenderFilterIOException
javax.portlet.PortletException
protected void doCommonFilter(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response,
javax.portlet.filter.FilterChain chain)
throws IOException,
javax.portlet.PortletException
PortletFilterUtils.doFilter(PortletRequest, PortletResponse, FilterChain)
IOException
javax.portlet.PortletExceptionpublic void destroy()
Note: This method will be called from standard filter destruction as well as filter bean destruction in a Spring application context.
This default implementation is empty.
destroy in interface javax.portlet.filter.PortletFilterdestroy in interface org.springframework.beans.factory.DisposableBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||