Interface SessionManager
The session is stored in the backing database, and is referenced by a session cookie in the browser. The lifetime of the session is governed by the configuration of the caching service. Normally, the session lifetime is rolling; extended as the user is active.
By default, data attached to a session is scoped to the plugin instance; meaning, session data added
by a configured plugin can only be read by that same plugin instance. This behavior can be overridden,
so that multiple plugin instances within the same plugin group can share session data. To enable this,
add a Shared-Session-Sandbox
attribute with the value of true
to the JAR MANIFEST of
each plugin within the same plugin group that should share session data. Plugins do not need to be of the
same type to share data.
Note 1: Plugins in different plugin groups will not share session data, regardless whether
they have this feature enabled.
Note 2: plugins without this MANIFEST attribute will not share session data with plugins
that have this feature enabled.
- Since:
- 2.1.0
-
Method Summary
Modifier and TypeMethodDescriptionGet the data for the given key.getFromSession
(String sessionId, String key) Get data from another session.The session ID for the current session.void
Add a new entry into the session.void
putIntoSession
(String sessionId, Attribute data) putIntoSession is similar toput(Attribute)
but allows the caller to put data into another session.Remove the data for the given key.
-
Method Details
-
put
Add a new entry into the session. The attribute nameAttribute.getName()
is used- Parameters:
data
- The data to store
-
remove
Remove the data for the given key.- Parameters:
key
- the key to remove data for- Returns:
- The data that was removed, or null if none was found.
-
get
Get the data for the given key.- Parameters:
key
- The key to lookup data for- Returns:
- The stored data, or null if not found
-
getSessionId
String getSessionId()The session ID for the current session.- Returns:
- the string value for the current session
-
putIntoSession
putIntoSession is similar toput(Attribute)
but allows the caller to put data into another session. This could be needed when a component is waiting for an out of band event. Then the out of band event can place an updated value in the component's session, notifying it about the event.- Parameters:
sessionId
- The session ID for the session to place the data indata
- The data
-
getFromSession
Get data from another session.- Parameters:
sessionId
- ID of the session to read data fromkey
- The key to lookup data for- Returns:
- attribute from the given session
- Since:
- 6.2.0
-