apollo.Session
Class SessionManager
java.lang.Object
|
+--apollo.Session.SessionManager
- All Implemented Interfaces:
- java.io.Serializable
- public class SessionManager
- extends java.lang.Object
- implements java.io.Serializable
This is the SessionManager. It provides the managing services
of the persistant WebSession objects. It will issues, expires, returns
session information. It supports POST and GET. COOKIES are not implemented.
The sessions can be made persistant between server start and stop cycles
using the provided serialization methods.
- See Also:
- Serialized Form
Constructor Summary |
SessionManager(ManagerTracker MT,
int timeout,
boolean logoutDup)
The initializer for the SessionManger. |
SessionManager(ManagerTracker MT,
int timeout,
boolean logoutDup,
java.lang.String sessionFilename)
Initializes the sessionManager, will attempt to read serialized sessions
off disk. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SessionManager
public SessionManager(ManagerTracker MT,
int timeout,
boolean logoutDup)
- The initializer for the SessionManger. This must be called before you can
access the SessionManager.
- Parameters:
timeout
- The default maximum number of seconds that can elapse between transactions before session expirationlogoutDup
- If true will expire sessions for existing userIDs in the database, false will ignore duplicates
SessionManager
public SessionManager(ManagerTracker MT,
int timeout,
boolean logoutDup,
java.lang.String sessionFilename)
- Initializes the sessionManager, will attempt to read serialized sessions
off disk. If the sessions are corrupt or missing, blank tables will be used.
- Parameters:
timeout
- The default maximum number of seconds that can elapse between transactions before session expirationsessionFilename
- The filename which should be used to read serialized sessions from disklogoutDup
- If true will expire sessions for existing userIDs in the database, false will ignore duplicates
setDefaultTimeout
public void setDefaultTimeout(int i)
- This sets the default Timeout. Which is the maximum number of seconds
which may elapse before the session becomes expired.
- Parameters:
i
- Number of seconds for the default Timeout
getDefaultTimeout
public int getDefaultTimeout()
- Returns:
- Default Timeout
destroy
public void destroy()
- This serializes the sessions to disk. This should normally be called any
time the boat is going down. Fortunatly with servlets this is usually only
in destroy().
serialize
public void serialize()
throws java.io.IOException
getSession
public WebSession getSession(java.lang.String sessionID)
throws InvalidSessionID,
SessionExpired
- This retrives the session object. If it does not exist or is invalid, an exception
is thrown
- Parameters:
sessionID
- The sessionID of the session you want returned- Returns:
- WebSession The current Session
- Throws:
InvalidSessionID
- The sessionID was not in the databaseSessionExpired
- The Session was expired
getSession
public WebSession getSession(java.lang.String sessionID,
boolean returnInvalid)
throws InvalidSessionID,
SessionExpired
- This retrives the session object. It will throw an exception if the session does
not exist, and will throw an exception if returnInvalid is false
- Parameters:
sessionID
- The sessionID of the session you want returnedreturnInvalid
- Will return invalid sessions without an exception- Returns:
- WebSession The current Session
- Throws:
InvalidSessionID
- The sessionID was not in the databaseSessionExpired
- The Session was expired
newSession
public WebSession newSession(java.lang.String username,
int timeout)
newSession
public WebSession newSession(int timeout)
newSession
public WebSession newSession(java.lang.String username)
newSession
public WebSession newSession()
remoteNewSession
public void remoteNewSession(java.lang.String username,
int timeout,
WebSession thisSession)
getSessions
public java.util.Enumeration getSessions()