Miscellaneous objects


The following objects are used by portlets:

 

PortletContext

The PortletContext interface defines a portlet's view of the portlet container within which each portlet is running. PortletContext also allows a portlet to access resources available to it. For example, using the context, a portlet can access the portlet log, access context parameters common to all portlets within the portlet application, obtain URL references to resources or access portlet services .

The most important information related to the PortletContext is described in detail below.

InitParameters

Parameters are name/value pairs available to all portlets within the Web application. These are defined in the Web deployment descriptor under the <context-param> element. For example, if a group of portlets share a context parameter called "Webmaster" that contains the portal site's administrator email, each portlet could get that value and provide a "mailto" link in their help.

Attributes

Attributes are name/value pairs available to all portlets within the Web application. The portlet can get, set and remove attributes. Attributes of the context are stored on a single machine and are not distributed in a cluster.

Localized text

The getText() method is used by the portlet to access resource bundles within a given locale.

Resources

It is through the PortletContext that a portlet can load or include resources located in the portlet's application scope. Available methods are include() and getResourceAsStream(). The include() method is typically used to invoke JSPs for output.

Messaging

Through messaging it is possible to communicate between portlets and share data or send notifications. A message is sent by using the send() method. For more information, see Portlet messaging

Portlet services

The PortletService object allows portlets to use pluggable services via dynamic discovery.

Log

The PortletLog object provides the portlet with the ability to log informational, warning, or error messages. The log is maintained by the portlet container. Whether logging is enabled or not is at the discretion of the portlet container. For more information, see Message and trace logging .

This object is also available from the getPortletLog() method from the PortletAdapter class.

 

PortletWindow

The PortletWindow object represents the window that encloses a portlet. For example, on an HTML page, the portlet window can typically be rendered as a table cell. The portlet window can send events on manipulation of its various window controls, like when the user clicks minimize or close. The portlet, in turn, can interrogate the window about its current state. For example, a portlet can render its content differently depending on whether its window is maximized or not. The PortletWindow is available using the getWindow() method of the PortletRequest object.

 

User

The User interface represents the users of the portal and provides methods for accessing a subset of the attributes that make up the user profile, such as the user's full name or the user name. The User interface abstracts the underlying physical implementation of the one or more data stores which actually hold the user information.

The getUser() method is located at the PortletRequest and PortletSession. The PortletSession.getUser() method is deprecated and only returns null.

The PUMA API includes the User and Group classes, which include methods that provide fuller access to the attributes of these objects in the user subsystem of Member Services. Javadoc for the PUMA API is available to WebSphere Portal customers at the following URL:

  http://www.ibm.com/support/docview.wss?uid=swg27003745

In subsequent releases of WebSphere Portal, a new API will become available to access the new features of the user subsystem. In that timeframe, the com.ibm.wps.puma package will be maintained for a time for backward compatibility, but will no longer be enhanced to accommodate new function.

 

See also

Home |

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.