JBoss Community Archive (Read Only)

GateIn Portal 3.8

Global portlet.xml file

Global portlet.xml usecase

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 three steps in setting up a portlet filter:

  1. Implement a PortletFilter object.

  2. Define the filter in portlet application deployment descriptor.

  3. 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.

Global metadata

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"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">

</portlet-app>

Location

The path to the global portlet.xml is value of gatein.portlet.config in the configuration.properties file and varied by hosting application servers.

  • For Tomcat: $TOMCAT_HOME/gatein/conf/portlet.xml

  • For JBoss: $JBOSS_HOME/standalone/configuration/gatein/portlet.xml

Global metadata elements

The global 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

  • Portlet Mode and Window State

Portlet filter

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 deployed portlet.

<filter>
    <filter-name>org.exoplatform.portal.application.ApplicationMonitoringFilter</filter-name>
    <filter-class>org.exoplatform.portal.application.ApplicationMonitoringFilter</filter-class>
    <lifecycle>ACTION_PHASE</lifecycle>
    <lifecycle>RENDER_PHASE</lifecycle>
    <lifecycle>EVENT_PHASE</lifecycle>
    <lifecycle>RESOURCE_PHASE</lifecycle>
</filter>

Application Monitoring Filter supports four 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.

Portlet Mode and Window State

The global portlet.xml file is considered as an alternative place to declare custom Portlet Modes and Window States.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:20:22 UTC, last content change 2012-10-29 09:01:24 UTC.