|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
wt.session.SessionContext
A specialized Hashtable for maintaining static context partitioned by user session.
Supported API: true
Extendable: false
Nested Class Summary |
Nested classes inherited from class java.util.Hashtable |
|
Field Summary | |
private PropertyChangeSupport |
changeSupport
|
private static String |
RESOURCE
|
private static SessionCache |
sessionCache
|
private String |
sessionId
|
Fields inherited from class java.util.Hashtable |
|
Constructor Summary | |
SessionContext()
Construct a new session context. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
private static void |
createSessionCache()
|
static void |
destroy(String prefix,
String sessionId)
Allow more timely expiration of sessions in conjunction with servlet session timeout. |
static SessionContext |
getContext()
Get current session context. |
static SessionContext |
getContext(boolean authenticate)
Get current session context. |
static SessionContext |
getContext(String session_id)
Get the session context corresponding to a given session id. |
static SessionContext |
getContext(String prefix,
String sessionId)
Get current session context using a "prefix" and the JSP/Servlet Session Id as the key. |
static WTPrincipal |
getEffectivePrincipal()
Get the effective principal object associated with the current thread. |
private static SessionCache |
getSessionCache()
|
String |
getSessionId()
Get the unique session id associated with this context. |
static SessionContext |
newContext()
Create a new SessionContext object associated with the current thread. |
Object |
put(Object key,
Object value)
Put a new value in this method context. |
void |
register()
Register a session context in the session cache. |
Object |
remove(Object key)
Remove a value from this session context. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
static SessionContext |
setContext(SessionContext session_context)
Explicitly set the SessionContext object associated with the current thread. |
static WTPrincipal |
setEffectivePrincipal(WTPrincipal principal)
Set the effective principal object associated with the current thread. |
(package private) Object |
updateEntry(Object key,
Object value)
Put a new value in this session context without re-updating session cache. |
Methods inherited from class java.util.Hashtable |
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, size, toString, values |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static SessionCache sessionCache
private String sessionId
private transient PropertyChangeSupport changeSupport
Constructor Detail |
public SessionContext()
register
is called.
Until registered, there is no unique session id associated with this object.
Method Detail |
private static SessionCache getSessionCache()
private static void createSessionCache()
public String getSessionId()
public void register()
public static SessionContext getContext()
MethodContext
public static SessionContext getContext(boolean authenticate)
authenticate
- perform user authentication if creating a new session context.
MethodContext
public static SessionContext getContext(String session_id)
session_id
- the session id
public Object put(Object key, Object value)
hashtable.put
to update master session cache maintained
in the server manager and add property change support.
public Object remove(Object key)
Hashtable.remove
to update master session cache
maintained in the server manager and add property change support.
Object updateEntry(Object key, Object value)
public static SessionContext setContext(SessionContext session_context)
SessionContext
object associated with the current thread.
This method will typically be used in conjunction with a try/finally
block to
reset the value later. Setting to null restores the default.
For example:
... SessionContext new_context = ... SessionContext previous_context = SessionContext.setContext(new_context); try { SessionMgr.setPrincipal(AdministrativeDomainHelper.ADMINISTRATOR_NAME); doAdminStuff(); } catch (...) { ... } finally { SessionContext.setContext(previous_context); }
session_context
- a SessionContext
object or null
public static SessionContext newContext()
SessionContext
object associated with the current thread.
This method will typically be used in conjunction with a try/finally
block.
For example:
... SessionContext previous_context = SessionContext.newContext(); try { SessionMgr.setPrincipal(AdministrativeDomainHelper.ADMINISTRATOR_NAME); doAdminStuff(); } catch (...) { ... } finally { SessionContext.setContext(previous_context); }
public static WTPrincipal setEffectivePrincipal(WTPrincipal principal)
This method will typically be used in conjunction with a try/finally
block to
reset the value later.
For example:
... WTPrincipal principal = ... WTPrincipal previous = SessionContext.setEffectivePrincipal(principal); try { // Do special stuff } catch (...) { ... } finally { SessionContext.setEffectivePrincipal(previous); }
principal
- a WTPrincipal
object or null
public static WTPrincipal getEffectivePrincipal()
Principal
object or null if not set.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the listener list.
Property change events will be fired to all registered listeners whenever a
value in this hashtable is added, changed, or removed.
listener
- the PropertyChangeListener
to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list.
listener
- the PropertyChangeListener
to be removedpublic static SessionContext getContext(String prefix, String sessionId)
prefix
- used guarentee uniqueness to the keysessionId
- session id of the JSP/Servlet engine calling the method server
MethodContext
public static void destroy(String prefix, String sessionId)
prefix
- used guarentee uniqueness to the keysessionId
- session id of the JSP/Servlet engine calling the method server
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |