Description
For custom rendering, portlet windows sometimes requires access to part of portal state: current navigation, current node, current page type, e.t.c. We call such portion of portal state Portal Navigational Properties: those properties are naturally bound to the user navigation, i.e the current URL in the browser determine fully those properties, hence the name.
This specification introduces Portal Navigational Properties feature in GateIn. In brief, the feature provides:
- Canonical way to expose info on portal state
- Configuration of exposed portal navigational properties
- Property scope
- Qualified identifiers
- Access to portal state from portlet window, based on 'Public Render Parameter' concept of JSR 286, indeed the render parameter of a portlet is a way to express navigational state of a portlet, and a public render parameter is a good way to bind a portion of the portlet navigational state to the portal navigational properties.
Specification
Public Render Parameter
Supported Public Render Parameter
See section 11.1.2 in JSR-286 specification
PortletRequest
In each portlet request, the public render parameters are stored in a map accessible through method getPublicParameterMap. Inject the pairs of property identifier/value into the map would make them available to the portlet targeted by request
GateIn Portlet Container
As compliant to JSR 286, GateIn Portlet Container supports Public Render Parameter
Expose Portal Contextual Properties
A configurable service ContextualPropertyManager is designed to:
- Manage the list of exposed properties: identifiers, namespaces,...
- Retrieve the value of property
The service takes as argument an UIPortlet as input and extract from which what the portlet window could see.
public interface ContextualPropertyManager { public Map<QName, String[]> getProperties(UIPortlet portletWindow); }
Plugin Mechanism
To have portal state exposing supported by GateIn 's extension, implementation of ContextualPropertyManager is based on component plugin mechanism. Each plugin of ContextualPropertyManager service has type AbstractContextualPropertyProviderPlugin
public abstract class AbstractContextualPropertyProviderPlugin extends BaseComponentPlugin { public abstract void getProperties(UIPortlet portletWindow, Map<QName, String[]> properties); }
The getProperties method in the implementation of ContextualPropertyManager delegates to registered plugin.
Configuration
The following XML file depicts the configuration of ContextualPropertyManager service
<component-plugin> <name>PublicPropertiesPlugin</name> <set-method>addPlugin</set-method> <type>org.exoplatform.portal.application.state.PublicPropertiesPlugin</type> <init-params> <value-param> <name>namespaceURI</name> <description>Namespace URI</description> <value>http://www.gatein.org/xml/ns/prp_1_0</value> </value-param> </init-params> </component-plugin>
The plugin configuration provides the namespace URI of the XML QNames that will be bound by this plugin. Note that such plugin can also be configured externally via the external-component-plugins configuration.
Exposed public render parameters
At the moment the following public render parameters are bound and available, all the names are bound under the http://www.gatein.org/xml/ns/prp_1_0 namespace:
Name | Description | Example |
---|---|---|
navigation_uri | the current | home |
page_name | the page name (not available when portlet is in a layout) | Home Page |
site_type | the site type (portal/group/user values are possible) | portal |
site_name | the site name | classic |
window_show_info_bar | true when the portlet has the info bar displayed | true |
window_width | the window width (might not be available) | 800px |
window_height | the window height (might not be available) | 100px |
Example
An example is available in GateIn samples codebase.
Comments