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:
public void init(HttpServletRequest request, SSOToken session, String serviceName, SSOAdapter ssoAdapter) throws Exception
public void init(HttpServletRequest request, SSOToken session, SSOAdapter ssoAdapter) throws Exception
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 session and ssoAdapter parameters are assigned to protected instance variables of the same name. Both objects will become directly accessible in your subclass, as well as through the public methods getSession() and getSSOAdapter().
The ID value of user sessions becomes accessible through the public method getSessionID(), and the configuration name of the ssoAdapter becomes available through the public method getConfigName().
The context instance is registered as an SSOTokenListener on user sessions. SSOTokenEvent notifications will be received by this instance through its public void ssoTokenChanged(SSOTokenEvent evt) method. All subclasses will inherit this behavior, and as such, will automatically receive SSOTokenEvent change notifications for events such as logouts and timeouts. Your subclass might need to override the ssoTokenChanged method to provide additional behavior as necessary.
User client types are detected and made accessible through the public String getClientType() method. Once established, user content types become accessible through the public String getContentType() method.
User locales are determined and made accessible through the methods public Locale getLocale(), public Locale getUserLocale(), and public String getUserLocaleString().
User time zones are retrieved and stored in the protected TimeZone time zone instance variable.
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