Skip to main content
This revision made August 28, 2013 12:22, by Martin Scott Nicklous

Portlet Config

The PortletConfig object provides the portlet object with information to be used during initialization. It also provides access to the portlet context, default event namespace, public render parameter names, and the resource bundle that provides title-bar resources.

Initialization Parameters

The getInitParameterNames and getInitParameter methods of the PortletConfig interface return the initialization parameter names and values found in the portlet definition in the deployment descriptor.

Portlet Resource Bundle

Portlets may specify, in their deployment descriptor definition, some basic information that can be used for the portlet title-bar and for the portal’s categorization of the portlet. The specification defines a few resource elements for these purposes, title, short-title and keywords (see the PLT.25.10 Resource Bundles Section).

These resource elements can be directly included in the portlet definition in the deployment descriptor, or they can be placed in a resource bundle.

An example of a deployment descriptor defining portlet information inline could be:

 <portlet>
   ...
   <portlet-info>
     <title>Stock Quote Portlet</title>
     <short-title>Stock</short-title>
     <keywords>finance,stock market</keywords>
   </portlet-info>
   ...
 </portlet>

If the resources are defined in a resource bundle, the portlet must provide the name of the resource bundle. An example of a deployment descriptor defining portlet information in resource bundles could be:

 <portlet>
   ...
   <resource-bundle>com.foo.myApp.QuotePortlet</resource-bundle>
   ...
 </portlet>

If the portlet definition defines a resource bundle, the portlet-container must look up these values in the ResourceBundle. If the root resource bundle does not contain the resources for these values and the values are defined inline, the portlet container must add the inline values as resources of the root resource bundle.

If the portlet definition does not define a resource bundle and the information is defined inline in the deployment descriptor, the portlet container must create a ResourceBundle and populate it, with the inline values, using the keys defined in the PLT.25.10 Resource Bundles Section.

The <portlet-info> and <resource-bundle> elements are optional in the deployment descriptor. If neither are present, the portlet title will not be explicitly defined. In this case, it is left as a portlet container implementation detail to draw on other information, for example on the <portlet-name> or <display-name> values from the portlet descriptor, to define the portlet title.

The render method of the GenericPortlet uses the ResourceBundle object of the PortletConfig to retrieve the title of the portlet from the associated ResourceBundle or the inline information in the portlet definition.

Default Event Namespace

The getDefaultNamespace method of the PortletConfig interface returns the default namespace for events and public render parameters set in the portlet deployment descriptor with the default-namespace element, or the XML default namespace XMLConstants.NULL_NS_URI if no default namespace is provided in the portlet deployment descriptor.

Public Render Parameter Names

The getPublicRenderParameterNames method of the PortletConfig interface returns the public render parameter names found in the portlet definition in the deployment descriptor with the supported-public-render-parameter element or an empty enumeration if no public render parameters are defined for the current portlet definition.

Publishing Event QNames

The getPublishingEventQNames method of the PortletConfig interface returns the publishing event QNames found in the portlet definition in the deployment descriptor with the supported-publishing-event element or an empty enumeration if no publishing events are defined for the current portlet definition.

If the event was defined using the name element instead of the qname element the defined default namespace must be added as namespace for the returned QName.

Processing Event QNames

The getProcessingEventQNames method of the PortletConfig interface returns the processing event QNames found in the portlet definition in the deployment descriptor with the supported-processing-event element or an empty enumeration if no processing events are defined for the current portlet definition.

If the event was defined using the name element instead of the qname element the defined default namespace must be added as namespace for the returned QName.

Supported Locales

The getSupportedLocales method of the PortletConfig interface returns the supported locales found in the portlet definition in the deployment descriptor with the supported-locale element or an empty enumeration if no supported locales are defined for the current portlet definition.

Supported Container Runtime Options

The getContainerRuntimeOptions method returns an immutable Map containing portlet application level container runtime options merged with the portlet level container runtime options, containing the names as keys and the container runtime values as map values, or an empty Map if no portlet application level or portlet level container runtime options are set in the portlet.xml or supported by this portlet container. The map returned from getContainerRuntimeOptions will provide the subset the portlet container supports of the options the portlet has specified in the portlet deployment descriptor. The keys in the map are of type String. The values in the map are of type String array. If a container runtime option is set on the portlet application level and on the portlet level with the same name the setting on the portlet level takes precedence and overwrites the one set on the portal application level.

See section PLT 10.4 for a list of all predefined container runtime options.

Portlet Mode

The portlet descriptor allows specification of the portlet modes supported by the portlet. The supported portlet modes may be a subset of the standard portlet modes, and may include custom portlet modes. A portal implementation may define custom portlet modes that are managed by the portal. Portlets can declare additional custom portlet modes that are managed by the portlet. Custom portlet modes declared in the portlet descriptor as portal managed that are not supported by the portal are ignored. The getPortletModes method returns an enumeration of the portlet modes available to the portlet. The enumeration includes the standard portlet modes supported by the portlet, the declared portal-managed modes supported by the portal, and the declared portlet-managed modes.

Window State

The portlet descriptor allows specification of the window states supported by the portlet. The supported window states always include the standard window states, and may include custom window states. Portlets can declare support for custom window states in the deployment descriptor. Custom window states declared in the portlet descriptor that are not supported by the portal are ignored. The getWindowStates method returns an enumeration of the window states available to the portlet. The enumeration includes the standard window states and the custom window states declared by the portlet and supported by the portal.

Difference compared to previous revision
<span> See section PLT 10.4 for a list of all predefined container runtime options. <div id="PORTLETSPEC3-<span style="text-decoration:underline;color:green">1</span>8" style="background-color: #8f8;"> ==Portlet Mode== The portlet descriptor allows specification of the portlet modes supported by<span>
 
 
Close
loading
Please Confirm
Close