Helper class samples for web content context
We can create the helper classes PortletWCMContextHelper, PortalWCMContextHelper and WCMContextHelper from the sample code that is provided here to programmatically determine the current web content context. The context indicates a content item or site area that is rendered by a web content viewer.
Important: These helper classes are not provided by default with IBM Web Content Manager. Example code is provided here that we can take and use to implement the classes yourself.
The helper classes can be used by custom themes or custom portlets that need to render information that is related to the current context.
The web content viewer determines the context to be rendered by evaluating several conditions in the following order:
The viewer evaluates each condition in turn until it finds a valid context. As soon as the viewer finds a context, remaining conditions are not evaluated.
- Private render parameter
- path-info parameter
- Public render parameter
- Portlet configuration setting for the web content viewer
- Web content association defined for the page
Private render parameters and portlet configuration settings are visible only to the web content viewer. However, path-info parameters, public render parameters, and content associations are visible to all portlets on a page and to portal code (for example, in a theme).
- PortletWCMContextHelper
Use the PortletWCMContextHelper class to determine the web content context from within a portlet.
- PortalWCMContextHelper
Use the PortalWCMContextHelper class to determine the web content context from within portal code, such as a theme.
- WCMContextHelper
The WCMContextHelper helper class is an abstract class used by the PortalWCMContextHelper class and the PortletWCMContextHelper class.
Parent: Developing