EAF 7.6 Implementation

com.lutris.appserver.server.sessionEnhydra
Class StandardSessionManager

java.lang.Object
  extended by com.lutris.appserver.server.sessionEnhydra.StandardSessionManager
All Implemented Interfaces:
com.lutris.appserver.server.session.SessionManager, com.lutris.appserver.server.sessionEnhydra.StandardSessionIdleHandler
Direct Known Subclasses:
SimpleServletSessionManager

public class StandardSessionManager
extends java.lang.Object
implements com.lutris.appserver.server.session.SessionManager, com.lutris.appserver.server.sessionEnhydra.StandardSessionIdleHandler

This session manager maintains the mapping between session keys and sessions. It generates secure session keys that are safe to use as cookie values in web applications. It also manages the life of a session. If a session is not used (touched) for a preconfigured amount of time, then it is expired and removed from the session manager. The following parameters can be used to configure the session manager. They should be grouped together in a section, normally SessionManager, which is specified to the constructor.

Version:
$Revision: 1.12 $
Author:
John Marco, Shawn McMurdo, Kyle Clark, Mark Diekhans
See Also:
Config, StandardSessionHome, StandardSessionUserTable, BasicSessionHome, DiskPagedSessionHome, PersistentSessionHome

Field Summary
static java.lang.String CFG_EMPTY_SESSION_PATH
          The name of the config variable for the EmptySessionPath.
static java.lang.String CFG_ENCODE_FIRST_URL
          Url encoding for first page state (to force it or not) CFG_ENCODE_URL_STATE must not be set to NEVER for this parameter to take efect
static java.lang.String CFG_ENCODE_URL_STATE
          The name of the config variable for the url encoding state
static java.lang.String CFG_IDLE
          The name of the config variable for the max session idle time.
static java.lang.String CFG_LIFE
          The name of the config variable for the max session lifetime.
static java.lang.String CFG_NOUSER_IDLE
          The name of the config variable for the max idle time for sessions with no user.
static java.lang.String CFG_RANDOM
          The name of the config variable for the interval between introduction of randomness to the session key generator.
static java.lang.String CFG_SCAN
          The name of the config variable for the interval between scans for idle sessions.
static java.lang.String CFG_SESSION_HOME
          The name of the config variable for the session home settings.
static java.lang.String CFG_SESSION_HOME_TYPE
          The name of the config variable for the session home type.
protected static boolean defaultEmptySessionPath
          Determins whether to use empty path (/) as session cookie path attribute value! Default value is false which means - use application context path.
protected static java.lang.String defaultEncodeUrlState
          Indicates url encoding status.
protected static long defaultIdleScanInterval
          Default interval, in seconds, to scan for sessions to expire.
protected static long defaultMaxSessionIdleTime
          Default maximum session idle time, in seconds.
protected static long defaultMaxSessionLifeTime
          Default maximum session life time, in seconds.
protected static long[] defaultRandomizerIntervals
          Default list of randomize key generator time intervals, in seconds.
protected  boolean emptySessionPath
          determins whether to use empty path (/) as session cookie path attribute value!
static java.lang.String ENCODE_RANDOM_NO
           
static java.lang.String ENCODE_RANDOM_YES
           
static java.lang.String ENCODE_URL_ALWAYS
          Indicates that url encoding of session ids is always preformed.
static java.lang.String ENCODE_URL_AUTO
          Indicates that url encoding of session ids is preformed only when cookies are disabled on the client browser.
static java.lang.String ENCODE_URL_NEVER
          Indicates that url encoding of session ids is never preformed.
protected  boolean encodeFirstUrl
          Url encoding for first page state (force it or not)
protected  java.lang.String encodeUrlState
          The url encoding state.
protected  long maxNoUserSessionIdleTime
          Maximum session idle time, in seconds for sessions that don't have a User object associated with them.
protected  long maxSessionIdleTime
          Maximum session idle time, in seconds.
protected  int maxSessions
           
protected  java.util.Date maxSessionsDate
           
protected  int mode
          Represents the current session management mode.
static int MODE_BASIC
          Indicates that the session manager is using the basic session home interface to manage sessions.
static int MODE_CUSTOM
          Indicates that the session manager is using the custom home interface to manage sessions.
static int MODE_PAGE_TO_DB
          Indicates that the session manager is using the page to database home interface to manage sessions.
static int MODE_PAGE_TO_DISK
          Indicates that the session manager is using the page to disk home interface to manage sessions.
protected  long scanInterval
          The time in seconds between scans for idle sessions to expire.
static int SESSION_ACTIVE
          Indicates that a sesson is still active.
static int SESSION_EXPLICT_DELETE
          Indicates that a sesson was explictly deleted.
static int SESSION_IDLE_EXPIRE
          Indicates that a sesson was deleted due to idle time being exceeded.
static int SESSION_MAX_TIME
          Indicates that a sesson was deleted due to max time being exceeded.
protected  com.lutris.appserver.server.sessionEnhydra.StandardSessionHome sessionHome
          Table of currently active user sessions is managed by the session home.
 
Constructor Summary
StandardSessionManager()
           
StandardSessionManager(com.lutris.appserver.server.Application application, com.lutris.util.Config config, com.lutris.logging.LogChannel sessionMgrLogChannel)
          Creates a new SessionManager object.
StandardSessionManager(java.lang.ClassLoader classLoader, com.lutris.util.Config config, com.lutris.logging.LogChannel sessionMgrLogChannel)
           
 
Method Summary
 int activeSessionCount()
          Gets the number of currently active sessions.
 void cleanUpIdleSessions()
          Scans session table to determine if any sessions need to be expired.
 com.lutris.appserver.server.session.Session createSession()
          Create a new Session object and associate a unique random key.
 com.lutris.appserver.server.session.Session createSession(HttpPresentationComms comms)
           
 com.lutris.appserver.server.session.Session createSession(java.lang.String ipPortToken)
          Create a new Session object and associate a unique random key.
protected  void debug(int level, java.lang.String msg)
          Prints debug information under Logger.DEBUG.
 void deleteSession(com.lutris.appserver.server.session.Session session)
          Removes a session from the Session Table.
 void deleteSession(java.lang.String sessionKey)
          Removes a session from the Session Table.
 boolean getEmptySessionPath()
           
 boolean getEncodeFirstUrl()
          Returns the url encoding rule for the first application page (true/false).
 java.lang.String getEncodeUrlState()
          Returns the url encoding state.
 long getMaxNoUserSessionIdleTime()
          Returns the maximum no-user session idle time, in seconds.
 long getMaxSessionIdleTime()
          Returns the maximum session idle time, in seconds.
 long getMaxSessionLifeTime()
          Returns the maximum session life time, in seconds.
 int getMode()
          Returns the current mode for the session manager.
 com.lutris.appserver.server.session.Session getSaveSession(java.lang.Thread thread, java.lang.String sessionKey)
          Lookup the Session object associated with the specified session key.
 com.lutris.appserver.server.session.Session getSession(java.lang.String sessionKey)
          Lookup the Session object associated with the specified session key.
 com.lutris.appserver.server.session.Session getSession(java.lang.Thread thread, java.lang.String sessionKey)
          Lookup the Session object associated with the specified session key.
 com.lutris.appserver.server.session.Session getSession(java.lang.Thread thread, java.lang.String sessionKey, HttpPresentationComms comms)
          Support for director connector Director connector sets header :affCR: , in that case we need to delete active session and create new one , with new ipPortToken
 java.util.Enumeration getSessionKeys()
          Get all of the active sessions.
 java.util.Enumeration getSessionKeys(com.lutris.appserver.server.user.User user)
          Lookup the keys for the active sessions for a user.
protected  int isSessionExpired(com.lutris.appserver.server.sessionEnhydra.StandardSession session)
          Determine if a session should be expired based on the idle time.
protected  com.lutris.appserver.server.sessionEnhydra.StandardSessionHome loadSessionHome(com.lutris.util.Config config)
          Loads the StandardSessionHome used by this session manager.
protected  com.lutris.appserver.server.sessionEnhydra.StandardSessionUserTable loadSessionUserTable(com.lutris.util.Config config)
          Loads the StandardSessiondUserTable used by this session manager.
 int maxSessionCount()
          Gets the maximum number of concurent sessions that existed at any time since this object was created, or resetMaxSessionCount() was called.
 java.util.Date maxSessionCountDate()
          Gets the time when the maximum refered to by maxSessionCount() occured.
protected  com.lutris.appserver.server.sessionEnhydra.StandardSession newSession(java.lang.String sessionKey)
          Deprecated. The instance of StandardSessionHome should be replaced instead of extending this method.
 int pagedSessionCount()
          Gets the number of session that are paged to persistent store.
 void passivateSession(java.lang.Thread thread, java.lang.String sessionKey)
          Puts a session into the 'passive' state.
protected  void registerUser(com.lutris.appserver.server.session.Session session)
          Adds a session's user to the session-to-user table.
 void resetMaxSessionCount()
          Reset the maximum session count.
protected  void sessionDeleted(com.lutris.appserver.server.session.Session session, int reason)
          Method called when a session is deleted.
 boolean sessionExists(java.lang.String sessionKey)
          Returns whether the Session object associated with the specified session key exists.
 void setMaxSessionIdleTime(long maxSessionIdleTime)
          Sets the maximum session idle time, in seconds.
 void shutdown()
          Shutdown this session manager, stopping threads that are associated with it.
protected  void unregisterUser(com.lutris.appserver.server.session.Session session)
          Removes a session's user from the session-to-user table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

protected int mode
Represents the current session management mode.


MODE_BASIC

public static final int MODE_BASIC
Indicates that the session manager is using the basic session home interface to manage sessions.

See Also:
getMode(), BasicSessionHome, Constant Field Values

MODE_PAGE_TO_DISK

public static final int MODE_PAGE_TO_DISK
Indicates that the session manager is using the page to disk home interface to manage sessions.

See Also:
getMode(), DiskPagedSessionHome, Constant Field Values

MODE_PAGE_TO_DB

public static final int MODE_PAGE_TO_DB
Indicates that the session manager is using the page to database home interface to manage sessions.

See Also:
getMode(), PersistentSessionHome, Constant Field Values

MODE_CUSTOM

public static final int MODE_CUSTOM
Indicates that the session manager is using the custom home interface to manage sessions.

See Also:
getMode(), Constant Field Values

ENCODE_URL_NEVER

public static final java.lang.String ENCODE_URL_NEVER
Indicates that url encoding of session ids is never preformed.

See Also:
getEncodeUrlState(), Constant Field Values

ENCODE_URL_ALWAYS

public static final java.lang.String ENCODE_URL_ALWAYS
Indicates that url encoding of session ids is always preformed.

See Also:
getEncodeUrlState(), Constant Field Values

ENCODE_URL_AUTO

public static final java.lang.String ENCODE_URL_AUTO
Indicates that url encoding of session ids is preformed only when cookies are disabled on the client browser. This is automatically detected.

See Also:
getEncodeUrlState(), Constant Field Values

ENCODE_RANDOM_YES

public static final java.lang.String ENCODE_RANDOM_YES
See Also:
Constant Field Values

ENCODE_RANDOM_NO

public static final java.lang.String ENCODE_RANDOM_NO
See Also:
Constant Field Values

defaultMaxSessionLifeTime

protected static long defaultMaxSessionLifeTime
Default maximum session life time, in seconds. Zero if there is no limit. A derived SessionManager may override this value to use the default expiration logic or override isSessionExpired to define custom expiration logic.

See Also:
lutris.session.StandardSessionManager#getMaxSessionLifeTime

defaultMaxSessionIdleTime

protected static long defaultMaxSessionIdleTime
Default maximum session idle time, in seconds. A derived SessionManager may override this value to use the default expiration logic or override isSessionExpired to define custom expiration logic. A value less-than or equal to zero disables idle checking. Default value is 30 minutes.

See Also:
getMaxSessionIdleTime()

defaultEncodeUrlState

protected static java.lang.String defaultEncodeUrlState
Indicates url encoding status. Assumes that comms.response.writeHTML(HTMLDocument doc) is used to commit the response to the client. The default is to Auto.
Never indicates urls are never encoded with session keys. This indicates that session cookies have to be used or no session state can be maintained.
Always indicates that urls are always encoded with session keys. Session cookies are never used.
Auto indicates that session cookies will be if available. If not, urls will automatically be encoded.

See Also:
getEncodeUrlState()

defaultIdleScanInterval

protected static long defaultIdleScanInterval
Default interval, in seconds, to scan for sessions to expire. A derived SessionManager may override this value. Default value is 30 seconds.


defaultRandomizerIntervals

protected static long[] defaultRandomizerIntervals
Default list of randomize key generator time intervals, in seconds. A list of prime numbers is recommended. A derived SessionManager may override this value.


defaultEmptySessionPath

protected static boolean defaultEmptySessionPath
Determins whether to use empty path (/) as session cookie path attribute value! Default value is false which means - use application context path.


CFG_EMPTY_SESSION_PATH

public static final java.lang.String CFG_EMPTY_SESSION_PATH
The name of the config variable for the EmptySessionPath.

See Also:
Constant Field Values

CFG_LIFE

public static final java.lang.String CFG_LIFE
The name of the config variable for the max session lifetime.

See Also:
Constant Field Values

CFG_IDLE

public static final java.lang.String CFG_IDLE
The name of the config variable for the max session idle time.

See Also:
Constant Field Values

CFG_ENCODE_URL_STATE

public static final java.lang.String CFG_ENCODE_URL_STATE
The name of the config variable for the url encoding state

See Also:
Constant Field Values

CFG_ENCODE_FIRST_URL

public static final java.lang.String CFG_ENCODE_FIRST_URL
Url encoding for first page state (to force it or not) CFG_ENCODE_URL_STATE must not be set to NEVER for this parameter to take efect

See Also:
Constant Field Values

CFG_NOUSER_IDLE

public static final java.lang.String CFG_NOUSER_IDLE
The name of the config variable for the max idle time for sessions with no user.

See Also:
Constant Field Values

CFG_SCAN

public static final java.lang.String CFG_SCAN
The name of the config variable for the interval between scans for idle sessions.

See Also:
Constant Field Values

CFG_RANDOM

public static final java.lang.String CFG_RANDOM
The name of the config variable for the interval between introduction of randomness to the session key generator.

See Also:
Constant Field Values

CFG_SESSION_HOME

public static final java.lang.String CFG_SESSION_HOME
The name of the config variable for the session home settings.

See Also:
Constant Field Values

CFG_SESSION_HOME_TYPE

public static final java.lang.String CFG_SESSION_HOME_TYPE
The name of the config variable for the session home type.

See Also:
Constant Field Values

SESSION_ACTIVE

public static final int SESSION_ACTIVE
Indicates that a sesson is still active.

See Also:
sessionDeleted(com.lutris.appserver.server.session.Session, int), Constant Field Values

SESSION_MAX_TIME

public static final int SESSION_MAX_TIME
Indicates that a sesson was deleted due to max time being exceeded.

See Also:
sessionDeleted(com.lutris.appserver.server.session.Session, int), Constant Field Values

SESSION_IDLE_EXPIRE

public static final int SESSION_IDLE_EXPIRE
Indicates that a sesson was deleted due to idle time being exceeded.

See Also:
sessionDeleted(com.lutris.appserver.server.session.Session, int), Constant Field Values

SESSION_EXPLICT_DELETE

public static final int SESSION_EXPLICT_DELETE
Indicates that a sesson was explictly deleted.

See Also:
sessionDeleted(com.lutris.appserver.server.session.Session, int), Constant Field Values

sessionHome

protected com.lutris.appserver.server.sessionEnhydra.StandardSessionHome sessionHome
Table of currently active user sessions is managed by the session home. Different implementations of StandardSessionHome can be loaded by this manager. A specific implementation can manage failover persistence, paging, etc.


maxSessions

protected int maxSessions

maxSessionsDate

protected java.util.Date maxSessionsDate

maxSessionIdleTime

protected long maxSessionIdleTime
Maximum session idle time, in seconds. A value less-than or equal to zero disables idle checking.

See Also:
getMaxSessionIdleTime()

encodeUrlState

protected java.lang.String encodeUrlState
The url encoding state. Either Never Always Auto.


encodeFirstUrl

protected boolean encodeFirstUrl
Url encoding for first page state (force it or not)


maxNoUserSessionIdleTime

protected long maxNoUserSessionIdleTime
Maximum session idle time, in seconds for sessions that don't have a User object associated with them. A value less-than or equal to zero disables idle checking.

See Also:
getMaxNoUserSessionIdleTime()

scanInterval

protected long scanInterval
The time in seconds between scans for idle sessions to expire.


emptySessionPath

protected boolean emptySessionPath
determins whether to use empty path (/) as session cookie path attribute value!

Constructor Detail

StandardSessionManager

public StandardSessionManager()

StandardSessionManager

public StandardSessionManager(com.lutris.appserver.server.Application application,
                              com.lutris.util.Config config,
                              com.lutris.logging.LogChannel sessionMgrLogChannel)
                       throws com.lutris.util.ConfigException,
                              com.lutris.appserver.server.session.SessionException
Creates a new SessionManager object. This constructor will first looks for the session manager configuration parameters that have the specified configuration prefix prepended to the standard session manager configuration option.

Parameters:
app - the application associate with this session manager.
config - Object parsed from configuration file. This should be for the section constaining the session manager configuration.
sessionMgrLogChannel - If not null, channel to log debugging information to.
Throws:
com.lutris.util.ConfigException - signifies a problem in the configuration file.
com.lutris.appserver.server.session.SessionException - if all classes (Home and UserTable) couldn't be loaded by the session manager.

StandardSessionManager

public StandardSessionManager(java.lang.ClassLoader classLoader,
                              com.lutris.util.Config config,
                              com.lutris.logging.LogChannel sessionMgrLogChannel)
                       throws com.lutris.util.ConfigException,
                              com.lutris.appserver.server.session.SessionException
Throws:
com.lutris.util.ConfigException
com.lutris.appserver.server.session.SessionException
Method Detail

loadSessionHome

protected com.lutris.appserver.server.sessionEnhydra.StandardSessionHome loadSessionHome(com.lutris.util.Config config)
                                                                                  throws com.lutris.util.ConfigException,
                                                                                         com.lutris.appserver.server.session.SessionException
Loads the StandardSessionHome used by this session manager.

Parameters:
config - This session manager's config section.
Throws:
com.lutris.util.ConfigException - if the configuration is invalid.
com.lutris.appserver.server.session.SessionException - if the StandardSessionHome could not be loaded.

loadSessionUserTable

protected com.lutris.appserver.server.sessionEnhydra.StandardSessionUserTable loadSessionUserTable(com.lutris.util.Config config)
                                                                                            throws com.lutris.util.ConfigException,
                                                                                                   com.lutris.appserver.server.session.SessionException
Loads the StandardSessiondUserTable used by this session manager.

Parameters:
config - This session manager's config section.
Throws:
com.lutris.util.ConfigException - if the StandardSessionHome could not be loaded.
com.lutris.appserver.server.session.SessionException

shutdown

public void shutdown()
Shutdown this session manager, stopping threads that are associated with it.

Specified by:
shutdown in interface com.lutris.appserver.server.session.SessionManager

newSession

protected com.lutris.appserver.server.sessionEnhydra.StandardSession newSession(java.lang.String sessionKey)
                                                                         throws com.lutris.appserver.server.sessionEnhydra.CreateSessionException,
                                                                                com.lutris.appserver.server.session.SessionException
Deprecated. The instance of StandardSessionHome should be replaced instead of extending this method.

Allocate a new StandardSession object. This maybe overridden by derived session managers to allocated a Session object derived from StandardSession. This is called by createSession.

Parameters:
sessionKey - The session key to associate with the session.
Returns:
session The new StandardSession object.
Throws:
com.lutris.appserver.server.sessionEnhydra.CreateSessionException
com.lutris.appserver.server.session.SessionException
See Also:
StandardSession

createSession

public com.lutris.appserver.server.session.Session createSession()
                                                          throws com.lutris.appserver.server.session.SessionException
Create a new Session object and associate a unique random key. No User is initially associated with (Session.getUser() returns null/

Specified by:
createSession in interface com.lutris.appserver.server.session.SessionManager
Returns:
session The new Session object.
Throws:
com.lutris.appserver.server.session.SessionException - if the session cannot be created.
See Also:
Session

createSession

public com.lutris.appserver.server.session.Session createSession(java.lang.String ipPortToken)
                                                          throws com.lutris.appserver.server.session.SessionException
Create a new Session object and associate a unique random key. No User is initially associated with (Session.getUser() returns null/

Specified by:
createSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
ipPortToken - The base64 encoded IP and Port number to include in session key
Returns:
session The new Session object.
Throws:
com.lutris.appserver.server.session.SessionException - if the session cannot be created.
See Also:
Session

createSession

public com.lutris.appserver.server.session.Session createSession(HttpPresentationComms comms)
                                                          throws com.lutris.appserver.server.session.SessionException
Specified by:
createSession in interface com.lutris.appserver.server.session.SessionManager
Throws:
com.lutris.appserver.server.session.SessionException

registerUser

protected void registerUser(com.lutris.appserver.server.session.Session session)
                     throws com.lutris.appserver.server.session.SessionException
Adds a session's user to the session-to-user table. This is called by the Session object to associate a session with a user.

Parameters:
session - The now logged-in Session instance to store in the session table.
Throws:
com.lutris.appserver.server.session.SessionException - if an error occurs.
See Also:
Session, User, unregisterUser(com.lutris.appserver.server.session.Session)

unregisterUser

protected void unregisterUser(com.lutris.appserver.server.session.Session session)
                       throws com.lutris.appserver.server.session.SessionException
Removes a session's user from the session-to-user table. This is called by the Session object to disassoicate a user from a session.

Parameters:
session - The now Session instance the user is being logged out from.
Throws:
com.lutris.appserver.server.session.SessionException - if an error occurs.
See Also:
Session

isSessionExpired

protected int isSessionExpired(com.lutris.appserver.server.sessionEnhydra.StandardSession session)
Determine if a session should be expired based on the idle time. This method is designed to be overriden by derived classes that want to use different idle time checks.

Parameters:
session - Session to check.
Returns:
A reason code for the experation. One of SESSION_MAX_TIME, SESSION_IDLE_EXPIRE, or SESSION_ACTIVE, to indicate that the session is not expired.
See Also:
sessionDeleted(com.lutris.appserver.server.session.Session, int), maxSessionIdleTime, maxNoUserSessionIdleTime

sessionDeleted

protected void sessionDeleted(com.lutris.appserver.server.session.Session session,
                              int reason)
Method called when a session is deleted. This method is designed to be overriden by derived classes that want need to take specific action, such as saving the sessions state. The default implementation of this method does nothing.

Parameters:
session - Session that is being delete.
reason - The reason the session was being deleted. One of SESSION_MAX_TIME, SESSION_IDLE_EXPIRE, SESSION_EXPLICT_DELETE.
See Also:
isSessionExpired(com.lutris.appserver.server.sessionEnhydra.StandardSession)

deleteSession

public void deleteSession(com.lutris.appserver.server.session.Session session)
                   throws com.lutris.appserver.server.session.SessionException
Removes a session from the Session Table. This method is used to log a user off the application. Note that sessionDeleted() is called.

Specified by:
deleteSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
session - Session object to remove from table removed.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be deleted.

deleteSession

public void deleteSession(java.lang.String sessionKey)
                   throws com.lutris.appserver.server.session.SessionException
Removes a session from the Session Table. This method is used to log a user off the application. Note that sessionDeleted() is called.

Specified by:
deleteSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
sessionKey - A key corresponding to a user session to be removed.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be deleted.

passivateSession

public void passivateSession(java.lang.Thread thread,
                             java.lang.String sessionKey)
                      throws com.lutris.appserver.server.session.SessionException
Puts a session into the 'passive' state. A 'passive' session may be made persistent.

Specified by:
passivateSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
thread - the thread currently associated with the session.
sessionKey - the session key for the session that will be made persistent.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be put into the passive state.

cleanUpIdleSessions

public void cleanUpIdleSessions()
                         throws com.lutris.appserver.server.session.SessionException
Scans session table to determine if any sessions need to be expired.

Specified by:
cleanUpIdleSessions in interface com.lutris.appserver.server.sessionEnhydra.StandardSessionIdleHandler
Throws:
com.lutris.appserver.server.session.SessionException - if an error occurs.

sessionExists

public boolean sessionExists(java.lang.String sessionKey)
                      throws com.lutris.appserver.server.session.SessionException
Returns whether the Session object associated with the specified session key exists.

Specified by:
sessionExists in interface com.lutris.appserver.server.session.SessionManager
Parameters:
sessionKey - The String used to reference a Session object.
Returns:
If the key is associated with an active session, then return true, otherwise return false.
Throws:
com.lutris.appserver.server.session.SessionException - If existence of the session cannot be tested.

getSession

public com.lutris.appserver.server.session.Session getSession(java.lang.String sessionKey)
                                                       throws com.lutris.appserver.server.session.SessionException
Lookup the Session object associated with the specified session key.

Each time a session is returned via this method, the session's last used (referenced) time is updated to the current time.

Specified by:
getSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
sessionKey - The String used to reference a Session object.
Returns:
If the key is associated with an active session, then the corresponding Session object is returned. Otherwise null is returned.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be retrieved.
See Also:
Session, StandardSession.touch()

getSession

public com.lutris.appserver.server.session.Session getSession(java.lang.Thread thread,
                                                              java.lang.String sessionKey)
                                                       throws com.lutris.appserver.server.session.SessionException
Lookup the Session object associated with the specified session key.

Each time a session is returned via this method, the session's last used (referenced) time is updated to the current time.

Specified by:
getSession in interface com.lutris.appserver.server.session.SessionManager
Parameters:
thread - the thread to associate with the session.
sessionKey - The String used to reference a Session object.
Returns:
If the key is associated with an active session, then the corresponding Session object is returned. Otherwise null is returned.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be retrieved.
See Also:
Session, StandardSession.touch()

getSession

public com.lutris.appserver.server.session.Session getSession(java.lang.Thread thread,
                                                              java.lang.String sessionKey,
                                                              HttpPresentationComms comms)
                                                       throws com.lutris.appserver.server.session.SessionException
Support for director connector Director connector sets header :affCR: , in that case we need to delete active session and create new one , with new ipPortToken

Specified by:
getSession in interface com.lutris.appserver.server.session.SessionManager
Throws:
com.lutris.appserver.server.session.SessionException

getSaveSession

public com.lutris.appserver.server.session.Session getSaveSession(java.lang.Thread thread,
                                                                  java.lang.String sessionKey)
                                                           throws com.lutris.appserver.server.session.SessionException
Lookup the Session object associated with the specified session key.

Each time a session is returned via this method, the session's last used (referenced) time is NOT!!! updated to the current time. This method is for save reporting without change the last time used.

Parameters:
thread - the thread to associate with the session.
sessionKey - The String used to reference a Session object.
Returns:
If the key is associated with an active session, then the corresponding Session object is returned. Otherwise null is returned.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be retrieved.
See Also:
Session, StandardSession.touch()

getSessionKeys

public java.util.Enumeration getSessionKeys()
                                     throws com.lutris.appserver.server.session.SessionException
Get all of the active sessions.

Specified by:
getSessionKeys in interface com.lutris.appserver.server.session.SessionManager
Returns:
An enumeration of the active sessions.
Throws:
com.lutris.appserver.server.session.SessionException - If the sessions cannot be retrieved.

getSessionKeys

public java.util.Enumeration getSessionKeys(com.lutris.appserver.server.user.User user)
                                     throws com.lutris.appserver.server.session.SessionException
Lookup the keys for the active sessions for a user. A given user may have multiple sessions associated with it (using FTP as an example, the "anonymous" account).

Specified by:
getSessionKeys in interface com.lutris.appserver.server.session.SessionManager
Parameters:
user - The user to search for.
Returns:
An enumeration containing the session keys of the active sessions for the user.
Throws:
com.lutris.appserver.server.session.SessionException - If the sessions cannot be retrieved.

activeSessionCount

public int activeSessionCount()
                       throws com.lutris.appserver.server.session.SessionException
Gets the number of currently active sessions.

Specified by:
activeSessionCount in interface com.lutris.appserver.server.session.SessionManager
Returns:
The number of currently active sessions.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be calculated.

pagedSessionCount

public int pagedSessionCount()
                      throws com.lutris.appserver.server.session.SessionException
Gets the number of session that are paged to persistent store.

Returns:
The number of currently paged sessions.
Throws:
com.lutris.appserver.server.session.SessionException - If the session cannot be calculated.

getMode

public int getMode()
            throws com.lutris.appserver.server.session.SessionException
Returns the current mode for the session manager.

Returns:
the mode.
Throws:
com.lutris.appserver.server.session.SessionException - If the mode cannot be determined.
See Also:
MODE_BASIC, MODE_PAGE_TO_DISK, MODE_PAGE_TO_DB, MODE_CUSTOM

maxSessionCount

public int maxSessionCount()
Gets the maximum number of concurent sessions that existed at any time since this object was created, or resetMaxSessionCount() was called. This is a historical highwater mark.

Specified by:
maxSessionCount in interface com.lutris.appserver.server.session.SessionManager
Returns:
The highwater mark for number of sessions, or -1.

maxSessionCountDate

public java.util.Date maxSessionCountDate()
Gets the time when the maximum refered to by maxSessionCount() occured.

Specified by:
maxSessionCountDate in interface com.lutris.appserver.server.session.SessionManager
Returns:
The Date of when the maximum number of sessions occured.

resetMaxSessionCount

public void resetMaxSessionCount()
                          throws com.lutris.appserver.server.session.SessionException
Reset the maximum session count. See maxSessionCount(). The highwater mark should be reset to the current number of sessions.

Specified by:
resetMaxSessionCount in interface com.lutris.appserver.server.session.SessionManager
Throws:
com.lutris.appserver.server.session.SessionException - if the max session count cannot be reset.

getMaxSessionLifeTime

public long getMaxSessionLifeTime()
Returns the maximum session life time, in seconds.


setMaxSessionIdleTime

public void setMaxSessionIdleTime(long maxSessionIdleTime)
Sets the maximum session idle time, in seconds.


getMaxSessionIdleTime

public long getMaxSessionIdleTime()
Returns the maximum session idle time, in seconds.


getEncodeUrlState

public java.lang.String getEncodeUrlState()
Returns the url encoding state. Either Never Always Auto

Specified by:
getEncodeUrlState in interface com.lutris.appserver.server.session.SessionManager

getEncodeFirstUrl

public boolean getEncodeFirstUrl()
Returns the url encoding rule for the first application page (true/false). CFG_ENCODE_URL_STATE must not be set to NEVER for this parameter to take efect

Specified by:
getEncodeFirstUrl in interface com.lutris.appserver.server.session.SessionManager

getMaxNoUserSessionIdleTime

public long getMaxNoUserSessionIdleTime()
Returns the maximum no-user session idle time, in seconds.


debug

protected void debug(int level,
                     java.lang.String msg)
Prints debug information under Logger.DEBUG.

Parameters:
level - the debug level.
msg - the message to print.

getEmptySessionPath

public boolean getEmptySessionPath()
Specified by:
getEmptySessionPath in interface com.lutris.appserver.server.session.SessionManager

EAF 7.6 Implementation