What is Portlet Filter

The Portlet Specification 2.0 has introduced concept of Portlet Filters similar to the Servlet filter, basic idea is Filters will get chance to execute some business logic before and after your portlet.

Portlet Filters can be used for implementing following type of functionality

  • The modification of request data by wrapping the request in customized versions of the request object

  • The modification of response data by providing customized versions of the response object.

  • The interception of an invocation of a portlet after its call



Even though the Portlet Filters try to copy the concept of Filters from Servlet Filters these are some of the main differences

  • The Servlet filters are mapped to particular URL, but since the Portlet Filters are not URL addressable, you will have to map filter to portlet

  • The Servlet life cycle has only one entry point which is service() method which calls either doGet, doPost based on HTTP method. In case of portlet the request processing can be divided into 4 types, render, action, resource and event and there is a separate filter for each of those types

No comments: