One of the key features of JSR 286 API is Portlet Filter.
As the name suggests, filters are used to intercept the request and
modify the response of a portlet before or after the execution of any
life cycle method
of a portlet. The concept of Portlet Filters are inherited from Servlet
Filters. The only difference is that in servlets there is only one type
of filter that can be applied because there is only one request
handling method i.e. service() method but in case of portlets we have 4 different type of filters that can be applied on each and every life cycle method of a portlet.
Portal Filter is used to apply some common filter logic at portal level rather than at individual portlet lifecycle methods level. The following are some of the scenarios where we can apply this filter.
javax.portlet.filter.RenderFilter (for render method)
javax.portlet.filter.ActionFilter (for processAction method)
javax.portlet.filter.EventFilter (for processEvent method)
javax.portlet.filter.ResourceFilter (for serveResource method)
Portal Filter is used to apply some common filter logic at portal level rather than at individual portlet lifecycle methods level. The following are some of the scenarios where we can apply this filter.
- Apply some logic or cache some objects in Dynacache before the theme is invoked.
- Set parameters in HttpSession and later retrieved and used in portlet.
- Apply some common logic to all the portals (Base and Virtual portals) on single installation.
- Alternate place to implement the common logic avoiding authorization filters.
- Allows you to set application objects in HttpSession without implementing SelfInitializingApplicationObject Interface to write custom PZN rules.
No comments:
Post a Comment