org.springframework.portlet.filter
Class GenericPortletFilterBean

java.lang.Object
  extended by org.springframework.portlet.filter.GenericPortletFilterBean
All Implemented Interfaces:
javax.portlet.filter.PortletFilter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.portlet.context.PortletContextAware
Direct Known Subclasses:
DelegatingPortletFilterProxy

public abstract class GenericPortletFilterBean
extends Object
implements javax.portlet.filter.PortletFilter, org.springframework.beans.factory.BeanNameAware, org.springframework.web.portlet.context.PortletContextAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean

Version:
$Revision: 23744 $
Author:
Eric Dalquist

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.
 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 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

logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses

Constructor Detail

GenericPortletFilterBean

public GenericPortletFilterBean()
Method Detail

setBeanName

public final void setBeanName(String beanName)
Stores the bean name as defined in the Spring bean factory.

Only relevant in case of initialization as bean, to have a name as fallback to the filter name usually provided by a FilterConfig instance.

Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware
See Also:
BeanNameAware, getFilterName()

setPortletContext

public final void setPortletContext(javax.portlet.PortletContext portletContext)
Stores the PortletContext that the bean factory runs in.

Only relevant in case of initialization as bean, to have a PortletContext as fallback to the context usually provided by a FilterConfig instance.

Specified by:
setPortletContext in interface org.springframework.web.portlet.context.PortletContextAware
See Also:
PortletContextAware, getPortletContext()

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Calls the 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.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
initFilterBean(), init(FilterConfig)

addRequiredProperty

protected final 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. This should be called from the constructor of a subclass.

This method is only relevant in case of traditional initialization driven by a FilterConfig instance.

Parameters:
property - name of the required property

init

public void init(javax.portlet.filter.FilterConfig filterConfig)
          throws javax.portlet.PortletException
Specified by:
init in interface javax.portlet.filter.PortletFilter
Throws:
javax.portlet.PortletException

initBeanWrapper

protected void initBeanWrapper(org.springframework.beans.BeanWrapper bw)
                        throws org.springframework.beans.BeansException
Initialize the BeanWrapper for this GenericPortletFilterBean, possibly with custom editors.

This default implementation is empty.

Parameters:
bw - the BeanWrapper to initialize
Throws:
org.springframework.beans.BeansException - if thrown by BeanWrapper methods
See Also:
PropertyEditorRegistry.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor)

getFilterConfig

public final javax.portlet.filter.FilterConfig getFilterConfig()
Make the FilterConfig of this filter available, if any. Analogous to GenericPortlet's getPortletConfig().

Public to resemble the getFilterConfig() method of the Portlet Filter version that shipped with WebLogic 6.1.

Returns:
the FilterConfig instance, or null if none available
See Also:
GenericPortlet.getPortletConfig()

getFilterName

protected final String getFilterName()
Make the name of this filter available to subclasses. Analogous to GenericPortlets's 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.

Returns:
the filter name, or null if none available
See Also:
GenericPortlet.getPortletName(), FilterConfig.getFilterName(), setBeanName(java.lang.String)

getPortletContext

protected final javax.portlet.PortletContext getPortletContext()
Make the PortletContext of this filter available to subclasses. Analogous to GenericPortlet's 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.

Returns:
the PortletContext instance, or null if none available
See Also:
GenericPortlet.getPortletContext(), javax.portlet.FilterConfig#getPortletContext(), setPortletContext(javax.portlet.PortletContext)

initFilterBean

protected void initFilterBean()
                       throws javax.portlet.PortletException
Subclasses may override this to perform custom initialization. All bean properties of this filter will have been set before this method is invoked.

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.

Throws:
javax.portlet.PortletException - if subclass initialization fails
See Also:
getFilterName(), getPortletContext()

destroy

public void destroy()
Subclasses may override this to perform custom filter shutdown.

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.

Specified by:
destroy in interface javax.portlet.filter.PortletFilter
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean


Copyright © 2012 Jasig. All Rights Reserved.