Interface Session
- All Superinterfaces:
- Attributes
- All Known Implementing Classes:
- ManagedSession
The interface to a generic session associated with a request.
This interface may be used directly, or it may be wrapped by an API specific
representation of a session. Such wrappers must implement the Session.API
sub interface.
Depending on the implementation the attribute values may be stored locally in memory or in a remote
database. The instances of the attribute values may be different to those passed to Attributes.setAttribute(String, Object)
or to those returned in previous Attributes.getAttribute(String) calls.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn API wrapper of the core session.static interfaceListener interface that if implemented by a value of an attribute of an enclosingContextat start, will be notified of session lifecycle events.static interfaceListener interface that if implemented by a session attribute value, will be notified of session value events.Nested classes/interfaces inherited from interface AttributesAttributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper
- 
Field SummaryFields inherited from interface AttributesNULL
- 
Method SummaryModifier and TypeMethodDescription<T extends Session.API>
 TgetApi()getId()longintstatic SessiongetSession(Object session) Get the session associated with an API session wrapper.voidInvalidate this session in the current context and all sessions of the same identity with associated contexts.booleanisNew()booleanisValid()voidRenew the identity of the session.voidsetMaxInactiveInterval(int secs) Methods inherited from interface AttributesasAttributeMap, clearAttributes, equals, getAttribute, getAttributeNameSet, hashCode, removeAttribute, setAttribute
- 
Method Details- 
getSession
- 
getApi- Type Parameters:
- T- The type of the API wrapper.
- Returns:
- An API wrapper of this session or null if there is none.
 
- 
isValidboolean isValid()- Returns:
- true if the session is has not been invalidated nor expired due to inactivity.
 
- 
getIdString getId()- Returns:
- A identifier for the session. Depending on the implementation may be unique within the context, the server, the JVM or a cluster.
- See Also:
 
- 
getExtendedIdString getExtendedId()- Returns:
- The session identifier as returned by getId()extended with additional routing information. The additional information does not form part of the identity, but may be used by implementations and associated infrastructure to help route request for the same session to the same server.
 
- 
getLastAccessedTimelong getLastAccessedTime()- Returns:
- the time, as represented by System.currentTimeMillis(), that the session was last accessed by a request.
 
- 
setMaxInactiveIntervalvoid setMaxInactiveInterval(int secs) - Parameters:
- secs- The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.
 
- 
getMaxInactiveIntervalint getMaxInactiveInterval()- Returns:
- The period in secs in which the session will remain valid (unless explicitly invalidated) when not accessed by any requests.
 
- 
renewIdRenew the identity of the session. Typically, this is done after a change of authentication or confidentiality.- Parameters:
- request- The request from which the session was obtained.
- response- The response which may be updated with the new session identity.
 
- 
invalidatevoid invalidate()Invalidate this session in the current context and all sessions of the same identity with associated contexts. 
- 
isNew- Returns:
- trueif the session has been newly created within the scope of the current request.
- Throws:
- IllegalStateException
 
- 
encodeURI
 
-