com.sun.portal.wireless.taglibs.base
Class Context

java.lang.Object
  extended bycom.sun.portal.wireless.taglibs.base.Context

public class Context
extends java.lang.Object

Implements a simple context mechanism for tracking user state across multiple requests. Developers should extend this class to create their own application-specific contexts.

See Also:
ContextCache

Field Summary
protected  java.lang.String charSetString
          The charset for this context.
protected  java.lang.String errorCode
          The error code for this context.
protected  Context parentContext
          The parent context.
protected  SSOToken session
          The user's session for this context.
protected  SSOAdapter ssoAdapter
          The SSOAdapter that provides access to the backend service utilized by this context.
protected  java.util.TimeZone timezone
          The user's time zone.
 
Constructor Summary
Context()
           
 
Method Summary
 java.util.Set getAttributeSet(java.lang.String name)
          Gets the attribute set from this context.
 java.lang.String getAttributeString(java.lang.String name)
          Gets an attribute string from this user's profile.
 java.lang.String getAttributeString(java.lang.String name, java.lang.String value)
          Gets an attribute string from this user's profile.
 java.lang.String getCharset()
          Gets the charset of this context.
 java.lang.String getClientType()
          Gets the client type.
 java.lang.String getConfigName()
          Gets the name of the SSOAdapter configuration that selected and configured the SSOAdapter used by this Context.
 java.lang.String getContentType()
          Gets the content type for this context.
static Context getContext(PageContext pageContext, java.lang.String contextClassName, java.lang.String contextCacheClassName, java.lang.String contextType)
          Gets a service context.
 java.lang.String getErrorCode()
          Gets the error code for this context.
 java.util.Locale getLocale()
          Gets the user's locale.
 Context getParentContext()
          Gets the parent context.
 SSOToken getSession()
          Gets the user's session from this context.
 SSOTokenID getSessionID()
          Gets the user's session ID from this context.
 SSOAdapter getSSOAdapter()
          Gets the SSOAdapter for this context.
 java.util.TimeZone getTimeZone()
          Gets the user's timezone.
 java.util.Locale getUserLocale()
          Gets the user locale.
 java.lang.String getUserLocaleString()
          Gets the user locale string.
 void init(HttpServletRequest request, SSOToken session, SSOAdapter ssoAdapter)
          Initializes this context.
 void init(HttpServletRequest request, SSOToken session, java.lang.String serviceName, SSOAdapter ssoAdapter)
          Initializes this context and associates it with a specified service.
 void setErrorCode(java.lang.String errorCode)
          Sets the error code for this context.
 void setParentContext(Context context)
          Sets the parent context.
 void ssoTokenChanged(SSOTokenEvent evt)
          Handles events from the Portal Session, and cleans up the context when the session goes invalid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected SSOToken session
The user's session for this context.

See Also:
getSession()

charSetString

protected java.lang.String charSetString
The charset for this context.

See Also:
getCharset()

timezone

protected java.util.TimeZone timezone
The user's time zone.

See Also:
getTimeZone()

errorCode

protected java.lang.String errorCode
The error code for this context.

See Also:
getErrorCode(), setErrorCode(String)

ssoAdapter

protected SSOAdapter ssoAdapter
The SSOAdapter that provides access to the backend service utilized by this context.


parentContext

protected Context parentContext
The parent context.

See Also:
getParentContext(), setParentContext(Context)
Constructor Detail

Context

public Context()
Method Detail

init

public void init(HttpServletRequest request,
                 SSOToken session,
                 java.lang.String serviceName,
                 SSOAdapter ssoAdapter)
          throws java.lang.Exception
Initializes this context and associates it with a specified service.

Parameters:
request - the HTTP servlet request
session - the user's session
serviceName - the service name
ssoAdapter - the SSOAdapter
Throws:
java.lang.Exception

init

public void init(HttpServletRequest request,
                 SSOToken session,
                 SSOAdapter ssoAdapter)
          throws java.lang.Exception
Initializes this context.

Parameters:
request - the HTTP servlet request
session - the user's session
ssoAdapter - the SSOAdapter
Throws:
java.lang.Exception

setParentContext

public void setParentContext(Context context)
Sets the parent context.

Parameters:
context - the parent context
See Also:
getParentContext()

getParentContext

public Context getParentContext()
Gets the parent context.

Returns:
the parent context
See Also:
setParentContext(Context)

getContext

public static Context getContext(PageContext pageContext,
                                 java.lang.String contextClassName,
                                 java.lang.String contextCacheClassName,
                                 java.lang.String contextType)
                          throws java.lang.Exception
Gets a service context. This method will attempt the following:
  1. Retrieve from pageContext, if not present...
  2. Retrieve from contextCache, if not present...
  3. Create a new context.
This method manipulates/uses the following page context attributes:

Parameters:
pageContext - the page context
contextClassName - the context class name
contextCacheClassName - the context cache class name
contextType - the context type
Throws:
java.lang.Exception

getAttributeString

public java.lang.String getAttributeString(java.lang.String name)
Gets an attribute string from this user's profile.

Parameters:
name - the name of the attribute stored within the service associated with this context
Returns:
attr the attribute string

getAttributeString

public java.lang.String getAttributeString(java.lang.String name,
                                           java.lang.String value)
Gets an attribute string from this user's profile.

Parameters:
name - the name of the attribute stored within the service associated with this context
value - a default value to return if the referenced attribute is empty
Returns:
attr the attribute string

getAttributeSet

public java.util.Set getAttributeSet(java.lang.String name)
Gets the attribute set from this context.

Parameters:
name - the name of the attribute stored within the service associated with this context

getSession

public SSOToken getSession()
Gets the user's session from this context.

Returns:
the user session as an SSOToken object

getSessionID

public SSOTokenID getSessionID()
Gets the user's session ID from this context.

Returns:
the session ID as an SSOTokenID object.

getLocale

public java.util.Locale getLocale()
Gets the user's locale.

Returns:
the user's locale, as a Locale object.

getTimeZone

public java.util.TimeZone getTimeZone()
Gets the user's timezone.

Returns:
the user's timezone, as a TimeZone object.

getErrorCode

public java.lang.String getErrorCode()
Gets the error code for this context. This method provides access to error codes set by the various MA command tags. It is primarily used by application JSPs that access the errorCode bean property provided by the various context tags. A null string value (zero-length string) indicates no error. A non-null error code whose value is a non-empty String indicates that an error has occurred.

Returns:
error code, as a String object.
See Also:
setErrorCode(String)

setErrorCode

public void setErrorCode(java.lang.String errorCode)
Sets the error code for this context. This method allows the various command tag implementations to set appropriate error codes.

Parameters:
errorCode - the error code
See Also:
getErrorCode()

ssoTokenChanged

public void ssoTokenChanged(SSOTokenEvent evt)
Handles events from the Portal Session, and cleans up the context when the session goes invalid.

Parameters:
evt - the session change event

getSSOAdapter

public SSOAdapter getSSOAdapter()
Gets the SSOAdapter for this context.

See Also:
ssoAdapter

getClientType

public java.lang.String getClientType()
Gets the client type.

Returns:
the client type, as a String object

getUserLocaleString

public java.lang.String getUserLocaleString()
Gets the user locale string.

Returns:
the user locale, as a String object

getUserLocale

public java.util.Locale getUserLocale()
Gets the user locale.

Returns:
the user locale, as a Locale object

getCharset

public java.lang.String getCharset()
Gets the charset of this context.

Returns:
the charset, as a String object.

getContentType

public java.lang.String getContentType()
Gets the content type for this context.

Returns:
the content type, as a String object.

getConfigName

public java.lang.String getConfigName()
Gets the name of the SSOAdapter configuration that selected and configured the SSOAdapter used by this Context.

Returns:
the same value as <Context object>.ssoAdapter.getName().