Friday, July 6, 2012

Explain Portlet Context?

PortalContext object provides portal server information to the portlet instance

The PortalContext object provides portal server information, such as the portal
server name, version number, supported window states, supported portlet modes, and
any other properties that are set by the portal server.

You should use the Portal-Context object in the following cases:

■ To customize the portlet’s request-handling logic based on the portal server in
which the portlet is deployed. This is similar to customizing the presentation
logic in HTML pages, using JavaScript, based on the browser type and version.

■ To check whether the portlet can add custom JavaScript and CSS DOM elements
to the head section of a portal page

■ To obtain a list of portlet modes supported by the portal server.

■ To obtain a list of window states supported by the portal server.

we can retrieve a PortalContext object using the PortletRequest object’s get-PortalContext method

and then getPortalInfo method is used to retrieve the portal server name and version information.

The PortalContext object defines getSupportedWindowStates and getSupported-PortletModes methods, which you can use to obtain information about the window states and portlet modes supported by your portal server

No comments:

Post a Comment