Sun Java System Portal Server Mobile Access 7.1 Developer's Guide

Understanding the Context Class

The Context class resides in the com.sun.portal.wireless.taglibs.base package, and defines the core state-tracking functionality that your custom subclasses will inherit.

To obtain an instance of this class, invoke its getContext method:

public static Context getContext(PageContext pageContext, String contextClassName,
String contextCacheClassName, String contextType);

Like all public static methods, getContext should be invoked by class name, not by object reference. When invoked, this method will first attempt to retrieve the context from the pageContext and contextCache objects. If both attempts fail, the method will instantiate a new context, placing a copy into the cache before returning. This method is most commonly invoked by Context subclasses as part of their own getContext implementations.

When the getContext method creates a new Context object, the method triggers an initialization phase that sets values for many of its properties. The process is initiated by invoking either of the following methods:

The first version initializes the context and associates the context with an Sun Java System Identity Server service. This version is typically invoked with super.init(...) from within the init(...) implementations of specific Context subclasses.

The second version initializes the context. This version is typically invoked by the context framework, such as Context.getContext(...), immediately after instantiating a new Context object.

Regardless of which version is invoked, the following tasks are always performed during context initialization:

The remaining methods of this class are simple methods for reading and writing the context’s properties. For example, public Context getParentContext() and public void setParentContext(Context), which get and set the parent context. Such methods are fully documented and available on the system where Portal Server 7.1 is installed, which is at this link:

http://hostname:port/portal/javadocs/ma/index.html