public interface ISession
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT
Default session timeout in milliseconds (20 minutes).
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(de.uplanet.lucy.server.session.ISessionListener p_listener,
boolean p_bWeak)
Add a listener for session events.
|
boolean |
containsKey(String p_strKey)
Test if a certain session variable exists.
|
Object |
get(String p_strKey)
Get a session variable.
|
Object |
get(String p_strKey,
Object p_objFallback)
Get a session variable or the specified fallback value.
|
long |
getCreationTime()
Get the time when this session was created.
|
String |
getId()
Get the unique session identifier.
|
long |
getLastAccessTime()
Get the time of the last access to this session.
|
Subject |
getSubject()
Get the subject that is associated with this session.
|
long |
getTimeout()
Get the session timeout.
|
IUser |
getUser()
Get the user that is associated with the session.
|
boolean |
isAnonymous()
Determine if the session is an anonymous session.
|
boolean |
isLoggedOut()
Check if the session is logged out.
|
boolean |
isStale()
Check if the session has timed out.
|
boolean |
isStale(long p_lTimeNow)
Test if the session has timed out.
|
Set<String> |
keySet()
Get a set that contains all session variable names.
|
void |
logout()
Performs a logout on this session.
|
void |
put(String p_strKey,
Object p_objValue)
Set a session variable.
|
void |
remove(String p_strKey)
Remove a session variable.
|
void |
setTimeout(long p_lTimeout)
Set the session timeout.
|
void |
touch()
Touch the session.
|
static final long DEFAULT_TIMEOUT
Subject getSubject()
long getCreationTime()
String getId()
boolean isAnonymous()
true
if the session is anonymous, false
otherwise.IUser getUser()
null
.Object get(String p_strKey)
p_strKey
- The name of the session variable.Object get(String p_strKey, Object p_objFallback)
p_strKey
- The name of the session variable.p_objFallback
- The fallback value that's being
used if the session variable does not exist.void put(String p_strKey, Object p_objValue)
p_strKey
- The name of the session variable.p_objValue
- The value of the session variable.boolean containsKey(String p_strKey)
p_strKey
- The name of the session variable.Set<String> keySet()
void remove(String p_strKey)
p_strKey
- The name of the session variable to be removed.void setTimeout(long p_lTimeout)
p_lTimeout
- The timeout in milliseconds.long getTimeout()
void touch()
boolean isLoggedOut()
true
is the session is logged out,
or false
otherwise.long getLastAccessTime()
boolean isStale()
The natural implementation of this method will return
isStale(System.currentTimeMillis())
.
true
if the session already has timed out,
false
otherwise.boolean isStale(long p_lTimeNow)
true
if the session has timed out,
false
otherwise.void logout()
void addListener(de.uplanet.lucy.server.session.ISessionListener p_listener, boolean p_bWeak)
p_listener
- The session listener to add.p_bWeak
- true
if the listener should
be weakly referenced, false
otherwise.