de.uplanet.lucy.server.session
Interface ISession

All Known Implementing Classes:
AbstractSession, GroovySession, Session

public interface ISession

Version:
$Revision: 64868 $

Field Summary
static long DEFAULT_TIMEOUT
          Default session timeout in milliseconds (20 minutes).
 
Method Summary
 void addListener(de.uplanet.lucy.server.session.ISessionListener p_listener, boolean p_bWeak)
          Add a listener for session events.
 boolean containsKey(java.lang.String p_strKey)
          Test if a certain session variable exists.
 java.lang.Object get(java.lang.String p_strKey)
          Get a session variable.
 java.lang.Object get(java.lang.String p_strKey, java.lang.Object p_objFallback)
          Get a session variable or the specified fallback value.
 long getCreationTime()
          Get the time when this session was created.
 java.lang.String getId()
          Get the unique session identifier.
 long getLastAccessTime()
          Get the time of the last access to this session.
 javax.security.auth.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.
 java.util.Set<java.lang.String> keySet()
          Get a set that contains all session variable names.
 void logout()
          Performs a logout on this session.
 void put(java.lang.String p_strKey, java.lang.Object p_objValue)
          Set a session variable.
 void remove(java.lang.String p_strKey)
          Remove a session variable.
 void setTimeout(long p_lTimeout)
          Set the session timeout.
 void touch()
          Touch the session.
 

Field Detail

DEFAULT_TIMEOUT

static final long DEFAULT_TIMEOUT
Default session timeout in milliseconds (20 minutes).

See Also:
Constant Field Values
Method Detail

getSubject

javax.security.auth.Subject getSubject()
Get the subject that is associated with this session.

Returns:
The associated subject.

getCreationTime

long getCreationTime()
Get the time when this session was created.

Returns:
The creation time, measured in milliseconds, between the current time and 01-01-1970 00:00:00 UTC.

getId

java.lang.String getId()
Get the unique session identifier.


isAnonymous

boolean isAnonymous()
Determine if the session is an anonymous session.

Returns:
true if the session is anonymous, false otherwise.

getUser

IUser getUser()
Get the user that is associated with the session.

Returns:
The user that is associated with this session, or null.

get

java.lang.Object get(java.lang.String p_strKey)
Get a session variable.

Parameters:
p_strKey - The name of the session variable.
Returns:
The session variable.

get

java.lang.Object get(java.lang.String p_strKey,
                     java.lang.Object p_objFallback)
Get a session variable or the specified fallback value.

Parameters:
p_strKey - The name of the session variable.
p_objFallback - The fallback value that's being used if the session variable does not exist.
Returns:
The session variable.

put

void put(java.lang.String p_strKey,
         java.lang.Object p_objValue)
Set a session variable.

Parameters:
p_strKey - The name of the session variable.
p_objValue - The value of the session variable.

containsKey

boolean containsKey(java.lang.String p_strKey)
Test if a certain session variable exists.

Parameters:
p_strKey - The name of the session variable.

keySet

java.util.Set<java.lang.String> keySet()
Get a set that contains all session variable names.

Returns:
A set wit all session variables.

remove

void remove(java.lang.String p_strKey)
Remove a session variable.

Parameters:
p_strKey - The name of the session variable to be removed.

setTimeout

void setTimeout(long p_lTimeout)
Set the session timeout.

Parameters:
p_lTimeout - The timeout in milliseconds.

getTimeout

long getTimeout()
Get the session timeout.

Returns:
p_lTimeout The timeout in milliseconds.

touch

void touch()
Touch the session.


isLoggedOut

boolean isLoggedOut()
Check if the session is logged out.

Returns:
true is the session is logged out, or false otherwise.

getLastAccessTime

long getLastAccessTime()
Get the time of the last access to this session.

Returns:
The time of last access.

isStale

boolean isStale()
Check if the session has timed out.

The natural implementation of this method will return isStale(System.currentTimeMillis()).

Returns:
true if the session already has timed out, false otherwise.

isStale

boolean isStale(long p_lTimeNow)
Test if the session has timed out.

Returns:
true if the session has timed out, false otherwise.

logout

void logout()
Performs a logout on this session.


addListener

void addListener(de.uplanet.lucy.server.session.ISessionListener p_listener,
                 boolean p_bWeak)
Add a listener for session events.

Parameters:
p_listener - The session listener to add.
p_bWeak - true if the listener should be weakly referenced, false otherwise.


Last updated: 2011-08-11 10-04
Copyright © 2000-2011 United Planet. All Rights Reserved.