Package org.forgerock.http.session
Class SessionContext
- java.lang.Object
-
- org.forgerock.services.context.AbstractContext
-
- org.forgerock.http.session.SessionContext
-
- All Implemented Interfaces:
Context
public final class SessionContext extends AbstractContext
ASessionContextis 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 theSessionContextwhich can then be accessed in subsequent filters and handlers in order to perform access control decisions, routing decisions, etc.Unlike an
AttributesContext, aSessionContexthas 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 theSessionandAsyncSessionManagerimplementation.Use an
AttributesContextfor transferring transient state between components when processing a single request.
-
-
Field Summary
-
Fields inherited from class org.forgerock.services.context.AbstractContext
data
-
-
Constructor Summary
Constructors Constructor Description SessionContext(JsonValue savedContext, ClassLoader classLoader)Restore from JSON representation.SessionContext(Context parent, Session session)Constructs a newSessionContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessiongetSession()Returns theSessionassociated with the remote client.SessionContextsetSession(Session session)Sets theSessionassociated with the remote client.-
Methods inherited from class org.forgerock.services.context.AbstractContext
as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
-
-
-
-
Constructor Detail
-
SessionContext
public SessionContext(Context parent, Session session)
Constructs a newSessionContext.- Parameters:
parent- The parentContext.session- The HTTPSession.
-
SessionContext
public SessionContext(JsonValue savedContext, ClassLoader classLoader)
Restore from JSON representation.- Parameters:
savedContext- The JSON representation from which this context's attributes should be parsed.classLoader- The ClassLoader which can properly resolve the persisted class-name.
-
-
Method Detail
-
getSession
public Session getSession()
Returns theSessionassociated with the remote client.- Returns:
- The
Sessionassociated with the remote client.
-
setSession
public SessionContext setSession(Session session)
Sets theSessionassociated with the remote client.- Parameters:
session- The session.- Returns:
- This
SessionContext.
-
-