The Portlet Specification introduces PortletFilter as a standard approach to extend the behaviors of portlet objects. For example, a filter can transform the content of portlet requests and portlet responses. According to the Portlet Specification, normally there are 3 steps in setting up a portlet filter:
Implement a PortletFilter object.
Define the filter in portlet application deployment descriptor.
Define the filter mapping in portlet definitions.
Two first steps are quite simple and easy to be done, however, at the step 3, developers/administrators need to replicate the filter mapping in many portlet definitions that makes work erroneous and tedious in several usecases. The global portlet feature is designed to compensate such limitation.
The Global metadata is declared in the
portlet.xml file conforming with Portlet 2.0 's XSD.
<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
The path to the global
portlet.xml is value of gatein.portlet.config in the
configuration.properties file and varied by hosting
portlet.xml file conforms to the schema of the portlet deployment descriptor defined in the Portlet
Specification with some restrictions. In this file, the following elements are supported:
Portlet filter: The Portlet filter mappings declared in the global
portlet.xml file are applied across portlet applications. With
the XML configuration below, the ApplicationMonitoringFilter filter involves in request handling on any
Application Monitoring Filter supports 4 lifecycle phases as the order below: ACTION_PHASE/ EVENT_PHASE/ RENDER_PHASE/ RESOURCE_PHASE and records statistic information on deployed portlets. The filter alternates actual monitoring mechanism in WebUI Framework.