public final class SessionContext extends AbstractContext
SessionContext
is a mechanism for maintaining state between components when processing a successive
requests from the same logical client or end-user. For example, a filter may store information about the end-user
in the SessionContext
which can then be accessed in subsequent filters and handlers in order to perform
access control decisions, routing decisions, etc.
Unlike an AttributesContext
, a SessionContext
has
a life-cycle that spans successive requests from the same client, although its content may be lost after periods
of inactivity. The exact details of how a "session" is associated with a client, how it is persisted between
requests, and if and when it is expired are the responsibility of the Session
and
SessionManager
implementation.
Use an AttributesContext
for transferring transient
state between components when processing a single request.
data
Constructor and Description |
---|
SessionContext(Context parent,
Session session)
Constructs a new
SessionContext . |
SessionContext(JsonValue savedContext,
ClassLoader classLoader)
Restore from JSON representation.
|
Modifier and Type | Method and Description |
---|---|
Session |
getSession()
Returns the
Session associated with the remote client. |
SessionContext |
setSession(Session session)
Sets the
Session associated with the remote client. |
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public SessionContext(Context parent, Session session)
SessionContext
.parent
- The parent Context
.session
- The HTTP Session
.public SessionContext(JsonValue savedContext, ClassLoader classLoader)
savedContext
- The JSON representation from which this context's attributes should be parsed.classLoader
- The ClassLoader which can properly resolve the persisted class-name.public Session getSession()
Session
associated with the remote client.Session
associated with the remote client.public SessionContext setSession(Session session)
Session
associated with the remote client.session
- The session.SessionContext
.Copyright © 2010-2018, ForgeRock All Rights Reserved.