Wednesday, November 18, 2009

How to write the portlet filter ?

You can write a portlet filter in geven two steps:

Step 1 - Write a filter class: A filter class should implement one or more of the above mentioned four interfaces and should provide a no argument public constructor. The filter class should also override the init() and destroy() methods of the javax.portlet.filter.PortletFilter interface.



Step 2 - Filter and filter mapping: Define the filter and filter mapping in the portlet.xml . This is done using the element, where you also need to specify the lifecycle call to which the filter should be applied. In the element you describe to which portlets the filter should be applied. If you want the filter to be applied to all portlets in the application, you need to used an asterisk as a wildcard.

No comments: