MVC portlet configuration file syntax

The portlet-config.xml file contains action tags, render tags, and plug-in tags.

MVC portlet configuration file syntax

Action tag

name
The action name, which is the unique identifier for the action definition. Must be unique across the entire file.
className

The fully qualified handler implementation. Parameters can be passed to this handler using the set-property tag.

A generic portlet action request handler, com.ibm.commerce.foundation.client.portal.handlers.MVCPortletActionHandler, has been provided to simplify the task of calling the WebSphere Commerce service client library, which is the recommended programming pattern. Several mandatory properties must be set:

clientLibrary
The fully qualified name of the client library interface.
clientMethod
The name of the client library method.
renderName
The name of the default render for this action, if one is not specified.
session
The session flag defines whether the action request is required to be executed in a stateful session environment. If set to true, a session will be created if none exists. The default value is false.

An example of the action tag is seen in the following example:


<action className="com.ibm.commerce.foundation.client.portal.handlers.MVCPortletActionHandler" 
name="ChangePersonalInformation">
<set-property name="clientLibrary" value="com.ibm.commerce.member.facade.client.MemberFacadeClient"/>
<set-property name="clientMethod" value="updatePerson" />
<set-property name="renderName" value="ChangePersonalInformationDisplay" />
<set-property name="session" value="true" />
</action>

Render tag

name
The render name, which is the unique identifier for the render definition. Must be unique across the entire file.
className
The fully qualified handler implementation. Parameters can be passed to this handler using the set-property tag.

A generic portlet render request handler, com.ibm.commerce.foundation.client.portal.handlers.MVCPortletRenderHandler, has been provided to simplify the task of forwarding to a JSP file.

Local forward definitions can be defined for each portlet mode:

mode
The portlet mode. Possible values are:
  • view
  • edit
  • help
  • config
path
The relative location of the JSP file.

If any of the above mode render definitions is not declared, then the corresponding portlet mode fallback definition is used. A default render definition must be declared with "default" name. It must have one definition for each supported portlet mode.

From the portlet action request, if a render name (a parameter called renderName) is passed in, then this name is used for looking up the render definition instead. Otherwise, the renderName defined in the action definition is used as the render name for the response page.

Other optional properties:

session
(Optional) The session flag defines whether the action request is required to be executed in a stateful session environment. If set to true, a session will be created if none exists. The default value is false.

An example of the render tag is seen in the following XML sample:


<render className="com.ibm.commerce.foundation.client.portal.handlers.MVCPortletRenderHandler" 
name="ChangePersonalInformationDisplay">
<forward mode="view" path="/member/ChangePersonalInformationDisplay.jsp" />
<set-property name="session" value="true" />
</render>

Plug-in tag

className
The fully qualified plug-in extension implementation. Parameters can be passed to this handler using the set-property tag.
type
The plug-in type. The supported types are:
  • activity
  • cache
  • context
  • credential
  • language
  • security
  • session
  • store

Three plug-in extension modules are shipped with the WebSphere Commerce Portlet:

Activity Plug-in Extension
The activity plug-in provides helper methods for managing WebSphere Commerce activity session from the MVCPortlet. Tasks that are included with this plug-in include:
  • Creates a new guest user activity session on WebSphere Commerce.
  • Migrates a given guest user shopping cart to the authenticated shopper shopping cart.
Cache Plug-in Extension
The cache plug-in provides helper methods for accessing the JSP caching service.
Context Service Plug-in Extension
A generic business context service plug-in extension, com.ibm.commerce.foundation.client.portal.services.MVCPortletContextService, which has been provided to aggregate tasks for generating the business context object for use in the client library.
Credential Plug-in Extension
This credential plug-in provides several services to the authentication callback handler to retrieve credential information of the current Portal user. These services include retrieving the LTPA token, WebSphere Commerce identity token, WebSphere Portal user name and password, and distinguish name (DN). It also provides a service to generate the authentication callback handler object.
Language
The language plug-in maps the portlet session locale into a corresponding WebSphere Commerce language ID.
Security
This security service provides the WebSphere Commerce implementation of the portlet security management.
Session
This session service provides the WebSphere Commerce implementation of the portlet session management.
Store Plug-in Extension
A generic store plug-in extension, com.ibm.commerce.foundation.client.portal.services.MVCPortletStoreService, which has been provided to present store services, such as resolving the store directory and the associated asset store.

An example of the plug-in tag is seen in the following XML sample:


 <portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletContextService" type="context">
  <set-property name="LocaleMap" value="language.properties" />
 </portlet-plug-in>
 <portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletCredentialService" type="credential">
 </portlet-plug-in>
 <portlet-plug-in className="com.ibm.commerce.foundation.client.portal.services.MVCPortletExtendedSiteService" type="store">
  <set-property name="AssetStoreMap" value="asset-store.properties" />
  <set-property name="StoreDirectoryMap" value="store-directory.properties" />  
 </portlet-plug-in>