public class RepositoryBackedSession extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentHashMap<String,com.amadeus.session.RepositoryBackedSession.Attribute> |
attrs
Each attribute that was get from repository, removed or set during request
is stored in this map.
|
protected SessionManager |
manager |
| Modifier | Constructor and Description |
|---|---|
protected |
RepositoryBackedSession(RepositoryBackedSession linked) |
|
RepositoryBackedSession(SessionData sessionData,
SessionManager manager,
SessionFactory factory)
Creates session based on given
SessionData using
SessionManager to manage lifecycle of session. |
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
Stores session to session repository.
|
protected void |
committed()
Called when the session was committed.
|
void |
doInvalidate(boolean expired)
This method performs invalidation of the session.
|
Object |
getAttribute(String key)
Returns value of the attribute
|
com.amadeus.session.RepositoryBackedSession.Attribute |
getAttributeFromCache(String name)
Retrieves attribute descriptor from internal cache.
|
Enumeration |
getAttributeNames()
Retrieves list of all known attributes.
|
List<String> |
getAttributeNamesWithValues()
Used internally to get attribute names that have values
|
Runnable |
getCommitter()
Returns committer that can be called to commit session.
|
int |
getConcurrentUses() |
long |
getCreationTime()
Returns the time when this session was created, measured in milliseconds
since midnight January 1, 1970 GMT.
|
String |
getId()
Returns a string containing the unique identifier assigned to this session.
|
long |
getLastAccessedTime()
Returns the last time the client sent a request associated with this
session, as the number of milliseconds since midnight January 1, 1970 GMT,
and marked by the time the request was received.
|
int |
getMaxInactiveInterval()
Returns maximum inactive interval for the session in seconds.
|
SessionData |
getSessionData()
Returns descriptor of this session (see
SessionData). |
SessionManager |
getSessionManager()
Returns
SessionManager associated to this http session. |
void |
invalidate()
Invalidates this session then unbinds any objects bound to it.
|
boolean |
isCommitted()
Returns
true if session was committed during request |
boolean |
isDirty()
Set to
true if session has been changed during request since
last commit. |
boolean |
isExpired()
Returns
true if session has expired. |
boolean |
isNew()
Returns
true if the client does not yet know about the session
or if the client chooses not to join the session. |
boolean |
isValid()
Returns
true if session is valid. |
void |
removeAttribute(String name)
Removes the object bound with the specified name from this session.
|
void |
setAttribute(String key,
Object value)
Binds an object to this session, using the name specified.
|
void |
setCommitted(boolean committed)
Sets the flag indicating if session was committed.
|
void |
setMaxInactiveInterval(int maxInactiveInterval)
Sets inactivity interval before session is invalidated.
|
protected final SessionManager manager
protected final ConcurrentHashMap<String,com.amadeus.session.RepositoryBackedSession.Attribute> attrs
public RepositoryBackedSession(SessionData sessionData, SessionManager manager, SessionFactory factory)
SessionData using
SessionManager to manage lifecycle of session.sessionData - the session descriptormanager - the associated session managerfactory - the session factoryprotected RepositoryBackedSession(RepositoryBackedSession linked)
public void setMaxInactiveInterval(int maxInactiveInterval)
maxInactiveInterval - inactivity interval in seconds before session is invalidatedpublic Object getAttribute(String key)
key - name of the attributepublic Enumeration getAttributeNames()
public List<String> getAttributeNamesWithValues()
public long getCreationTime()
long specifying when this session was created,
expressed in milliseconds since 1/1/1970 GMTIllegalStateException - if this method is called on an invalidated sessionpublic String getId()
UUID.IllegalStateException - if this method is called on an invalidated sessionpublic long getLastAccessedTime()
Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
long representing the last time the client sent a
request associated with this session, expressed in milliseconds
since 1/1/1970 GMTIllegalStateException - if this method is called on an invalidated sessionpublic int getMaxInactiveInterval()
public void invalidate()
IllegalStateException - if this method is called on an already invalidated sessionpublic void doInvalidate(boolean expired)
invalidate() method, invalidation is
effective immediately.expired - set to true if invalidate is due to expiringpublic boolean isNew()
true if the client does not yet know about the session
or if the client chooses not to join the session. For example, if an HTTP
server used only cookie-based sessions, and the client had disabled the use
of cookies, then a session would be new on each request.true if the server has created a session, but the
client has not yet joinedIllegalStateException - if this method is called on an already invalidated sessionpublic void removeAttribute(String name)
After this method executes, it calls
SessionNotifier.attributeRemoved(RepositoryBackedSession, String, Object)
.
name - the name of the object to remove from this sessionIllegalStateException - if this method is called on an invalidated sessionpublic com.amadeus.session.RepositoryBackedSession.Attribute getAttributeFromCache(String name)
name - the name of the attributenull if not presentpublic void setAttribute(String key, Object value)
After this method executes, and if the attribute was replaced the method
calls
SessionNotifier.attributeReplaced(RepositoryBackedSession, String, Object)
, and if it was new, the method calls
SessionNotifier.attributeAdded(RepositoryBackedSession, String, Object)
.
If the value passed in is null, this has the same effect as calling
removeAttribute().
key - the name to which the object is bound; cannot be nullvalue - the object to be boundIllegalStateException - if this method is called on an invalidated sessionpublic void commit()
protected void committed()
public boolean isValid()
true if session is valid. Session becomes invalid
following call to invalidate() method.true if session is validpublic boolean isExpired()
true if session has expired. Session is expired if
current time is less then sum of getLastAccessedTime() and maxtrue if session has expiredpublic boolean isDirty()
true if session has been changed during request since
last commit.true if session has been changedpublic Runnable getCommitter()
Runnable instance. See CommitterCommitter for this sessionpublic SessionData getSessionData()
SessionData).public boolean isCommitted()
true if session was committed during requesttrue if session was committed during requestpublic void setCommitted(boolean committed)
committed - flag indicating if session was committedpublic SessionManager getSessionManager()
SessionManager associated to this http session.SessionManager associated to this http session.public int getConcurrentUses()
Copyright © 2018 Amadeus s.a.s.. All rights reserved.