Package org.forgerock.http.session
Class SessionContext
java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.http.session.SessionContext
- All Implemented Interfaces:
Context
A
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
AsyncSessionManager implementation.
Use an AttributesContext for transferring transient
state between components when processing a single request.
-
Field Summary
Fields inherited from class org.forgerock.services.context.AbstractContext
data -
Constructor Summary
ConstructorsConstructorDescriptionSessionContext(JsonValue savedContext, ClassLoader classLoader) Restore from JSON representation.SessionContext(Context parent, Session session) Constructs a newSessionContext. -
Method Summary
Modifier and TypeMethodDescriptionReturns theSessionassociated with the remote client.setSession(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 Details
-
SessionContext
Constructs a newSessionContext.- Parameters:
parent- The parentContext.session- The HTTPSession.
-
SessionContext
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 Details
-
getSession
Returns theSessionassociated with the remote client.- Returns:
- The
Sessionassociated with the remote client.
-
setSession
Sets theSessionassociated with the remote client.- Parameters:
session- The session.- Returns:
- This
SessionContext.
-