org.springframework.portlet.filter
Class DelegatingPortletFilterProxy

java.lang.Object
  extended by org.springframework.portlet.filter.GenericPortletFilterBean
      extended by org.springframework.portlet.filter.DelegatingPortletFilterProxy
All Implemented Interfaces:
javax.portlet.filter.ActionFilter, javax.portlet.filter.EventFilter, javax.portlet.filter.PortletFilter, javax.portlet.filter.RenderFilter, javax.portlet.filter.ResourceFilter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.portlet.context.PortletContextAware

public class DelegatingPortletFilterProxy
extends GenericPortletFilterBean
implements javax.portlet.filter.ActionFilter, javax.portlet.filter.EventFilter, javax.portlet.filter.RenderFilter, javax.portlet.filter.ResourceFilter

Version:
$Revision: 23744 $
Author:
Eric Dalquist

Field Summary
 
Fields inherited from class org.springframework.portlet.filter.GenericPortletFilterBean
logger
 
Constructor Summary
DelegatingPortletFilterProxy()
           
 
Method Summary
 void destroy()
          Subclasses may override this to perform custom filter shutdown.
protected  void destroyDelegate(javax.portlet.filter.PortletFilter delegate)
          Destroy the PortletFilter delegate.
 void doFilter(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, javax.portlet.filter.FilterChain chain)
           
 void doFilter(javax.portlet.EventRequest request, javax.portlet.EventResponse response, javax.portlet.filter.FilterChain chain)
           
 void doFilter(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, javax.portlet.filter.FilterChain chain)
           
 void doFilter(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response, javax.portlet.filter.FilterChain chain)
           
protected  org.springframework.context.ApplicationContext findWebApplicationContext()
          Retrieve a WebApplicationContext from the PortletContext attribute with the configured name.
protected  String getTargetBeanName()
          Return the name of the target bean in the Spring application context.
protected  void initDelegate(boolean require)
          Initialize the PortletFilter delegate, defined as bean the given Spring application context.
protected  void initFilterBean()
          Subclasses may override this to perform custom initialization.
protected  void invokeDelegate(javax.portlet.filter.ActionFilter delegate, javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, javax.portlet.filter.FilterChain filterChain)
          Actually invoke the delegate ActionFilter with the given request and response.
protected  void invokeDelegate(javax.portlet.filter.EventFilter delegate, javax.portlet.EventRequest request, javax.portlet.EventResponse response, javax.portlet.filter.FilterChain filterChain)
          Actually invoke the delegate EventFilter with the given request and response.
protected  void invokeDelegate(javax.portlet.filter.RenderFilter delegate, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, javax.portlet.filter.FilterChain filterChain)
          Actually invoke the delegate RenderFilter with the given request and response.
protected  void invokeDelegate(javax.portlet.filter.ResourceFilter delegate, javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response, javax.portlet.filter.FilterChain filterChain)
          Actually invoke the delegate ResourceFilter with the given request and response.
protected  boolean isTargetFilterLifecycle()
          Return whether to invoke the PortletFilter.init and PortletFilter.destroy lifecycle methods on the target bean.
 void setTargetBeanName(String targetBeanName)
          Set the name of the target bean in the Spring application context.
 void setTargetFilterLifecycle(boolean targetFilterLifecycle)
          Set whether to invoke the PortletFilter.init and PortletFilter.destroy lifecycle methods on the target bean.
 
Methods inherited from class org.springframework.portlet.filter.GenericPortletFilterBean
addRequiredProperty, afterPropertiesSet, getFilterConfig, getFilterName, getPortletContext, init, initBeanWrapper, setBeanName, setPortletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.filter.PortletFilter
init
 

Constructor Detail

DelegatingPortletFilterProxy

public DelegatingPortletFilterProxy()
Method Detail

setTargetBeanName

public void setTargetBeanName(String targetBeanName)
Set the name of the target bean in the Spring application context. The target bean must implement the standard Portlet 2.3 PortletFilter interface.

By default, the filter-name as specified for the DelegatingFilterProxy in web.xml will be used.


getTargetBeanName

protected String getTargetBeanName()
Return the name of the target bean in the Spring application context.


setTargetFilterLifecycle

public void setTargetFilterLifecycle(boolean targetFilterLifecycle)
Set whether to invoke the PortletFilter.init and PortletFilter.destroy lifecycle methods on the target bean.

Default is "false"; target beans usually rely on the Spring application context for managing their lifecycle. Setting this flag to "true" means that the portlet container will control the lifecycle of the target PortletFilter, with this proxy delegating the corresponding calls.


isTargetFilterLifecycle

protected boolean isTargetFilterLifecycle()
Return whether to invoke the PortletFilter.init and PortletFilter.destroy lifecycle methods on the target bean.


initFilterBean

protected void initFilterBean()
                       throws javax.portlet.PortletException
Description copied from class: GenericPortletFilterBean
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.

Overrides:
initFilterBean in class GenericPortletFilterBean
Throws:
javax.portlet.PortletException - if subclass initialization fails
See Also:
GenericPortletFilterBean.getFilterName(), GenericPortletFilterBean.getPortletContext()

doFilter

public void doFilter(javax.portlet.ResourceRequest request,
                     javax.portlet.ResourceResponse response,
                     javax.portlet.filter.FilterChain chain)
              throws IOException,
                     javax.portlet.PortletException
Specified by:
doFilter in interface javax.portlet.filter.ResourceFilter
Throws:
IOException
javax.portlet.PortletException

doFilter

public void doFilter(javax.portlet.EventRequest request,
                     javax.portlet.EventResponse response,
                     javax.portlet.filter.FilterChain chain)
              throws IOException,
                     javax.portlet.PortletException
Specified by:
doFilter in interface javax.portlet.filter.EventFilter
Throws:
IOException
javax.portlet.PortletException

doFilter

public void doFilter(javax.portlet.RenderRequest request,
                     javax.portlet.RenderResponse response,
                     javax.portlet.filter.FilterChain chain)
              throws IOException,
                     javax.portlet.PortletException
Specified by:
doFilter in interface javax.portlet.filter.RenderFilter
Throws:
IOException
javax.portlet.PortletException

doFilter

public void doFilter(javax.portlet.ActionRequest request,
                     javax.portlet.ActionResponse response,
                     javax.portlet.filter.FilterChain chain)
              throws IOException,
                     javax.portlet.PortletException
Specified by:
doFilter in interface javax.portlet.filter.ActionFilter
Throws:
IOException
javax.portlet.PortletException

destroy

public void destroy()
Description copied from class: GenericPortletFilterBean
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
Overrides:
destroy in class GenericPortletFilterBean

findWebApplicationContext

protected org.springframework.context.ApplicationContext findWebApplicationContext()
Retrieve a WebApplicationContext from the PortletContext attribute with the configured name. The WebApplicationContext must have already been loaded and stored in the PortletContext before this filter gets initialized (or invoked).

Subclasses may override this method to provide a different WebApplicationContext retrieval strategy.

Returns:
the WebApplicationContext for this proxy, or null if not found
See Also:
#getContextAttribute()

initDelegate

protected void initDelegate(boolean require)
                     throws javax.portlet.PortletException
Initialize the PortletFilter delegate, defined as bean the given Spring application context.

The default implementation fetches the bean from the application context and calls the standard PortletFilter.init method on it, passing in the FilterConfig of this PortletFilter proxy.

Parameters:
wac - the root application context
Throws:
javax.portlet.PortletException - if thrown by the PortletFilter
See Also:
getTargetBeanName(), isTargetFilterLifecycle(), GenericPortletFilterBean.getFilterConfig(), javax.portlet.PortletFilter#init(javax.portlet.FilterConfig)

invokeDelegate

protected void invokeDelegate(javax.portlet.filter.ActionFilter delegate,
                              javax.portlet.ActionRequest request,
                              javax.portlet.ActionResponse response,
                              javax.portlet.filter.FilterChain filterChain)
                       throws javax.portlet.PortletException,
                              IOException
Actually invoke the delegate ActionFilter with the given request and response.

Parameters:
delegate - the delegate ActionFilter
request - the current action request
response - the current action response
filterChain - the current FilterChain
Throws:
javax.portlet.PortletException - if thrown by the PortletFilter
IOException - if thrown by the PortletFilter

invokeDelegate

protected void invokeDelegate(javax.portlet.filter.EventFilter delegate,
                              javax.portlet.EventRequest request,
                              javax.portlet.EventResponse response,
                              javax.portlet.filter.FilterChain filterChain)
                       throws javax.portlet.PortletException,
                              IOException
Actually invoke the delegate EventFilter with the given request and response.

Parameters:
delegate - the delegate EventFilter
request - the current Event request
response - the current Event response
filterChain - the current FilterChain
Throws:
javax.portlet.PortletException - if thrown by the PortletFilter
IOException - if thrown by the PortletFilter

invokeDelegate

protected void invokeDelegate(javax.portlet.filter.RenderFilter delegate,
                              javax.portlet.RenderRequest request,
                              javax.portlet.RenderResponse response,
                              javax.portlet.filter.FilterChain filterChain)
                       throws javax.portlet.PortletException,
                              IOException
Actually invoke the delegate RenderFilter with the given request and response.

Parameters:
delegate - the delegate RenderFilter
request - the current Render request
response - the current Render response
filterChain - the current FilterChain
Throws:
javax.portlet.PortletException - if thrown by the PortletFilter
IOException - if thrown by the PortletFilter

invokeDelegate

protected void invokeDelegate(javax.portlet.filter.ResourceFilter delegate,
                              javax.portlet.ResourceRequest request,
                              javax.portlet.ResourceResponse response,
                              javax.portlet.filter.FilterChain filterChain)
                       throws javax.portlet.PortletException,
                              IOException
Actually invoke the delegate ResourceFilter with the given request and response.

Parameters:
delegate - the delegate ResourceFilter
request - the current Resource request
response - the current Resource response
filterChain - the current FilterChain
Throws:
javax.portlet.PortletException - if thrown by the PortletFilter
IOException - if thrown by the PortletFilter

destroyDelegate

protected void destroyDelegate(javax.portlet.filter.PortletFilter delegate)
Destroy the PortletFilter delegate. Default implementation simply calls PortletFilter.destroy on it.

Parameters:
delegate - the PortletFilter delegate (never null)
See Also:
isTargetFilterLifecycle(), javax.portlet.PortletFilter#destroy()


Copyright © 2012 Jasig. All Rights Reserved.