Minimal implementation of the Manager interface that supports
no session persistence or distributable capabilities. This class may
be subclassed to create more sophisticated Manager implementations.
author: Craig R. McClanahan version: $Revision: 531901 $ $Date: 2007-04-24 14:24:34 +0200 (mar., 24 avr. 2007) $
getInfo() Return descriptive information about this Manager implementation and
the corresponding version number, in the format
<description>/<version>.
The message digest algorithm to be used when generating session
identifiers. This must be an algorithm supported by the
java.security.MessageDigest class on your platform.
The distributable flag for Sessions created by this Manager. If this
flag is set to true, any user attributes added to a
session controlled by this Manager must be Serializable.
Frequency of the session expiration, and related manager operations.
Manager operations will be done once for the specified amount of
backgrondProcess calls (ie, the lower the amount, the most often the
checks will occur).
Get a session from the recycled ones or create a new empty one.
The PersistentManager manager does not need to create session data
because it reads it from the Store.
Construct and return a new session object, based on the default
settings specified by this Manager's properties. The session
id will be assigned by this method, and available via the getId()
method of the returned session. If a new session cannot be created
for any reason, return null.
exception: IllegalStateException - if a new session cannot beinstantiated for any reason
Construct and return a new session object, based on the default
settings specified by this Manager's properties. The session
id specified will be used as the session id.
If a new session cannot be created for any reason, return
null.
Parameters: sessionId - The session id which should be used to create thenew session; if null, a new session id will begenerated exception: IllegalStateException - if a new session cannot beinstantiated for any reason
Return the active Session, associated with this Manager, with the
specified session id (if any); otherwise return null.
Parameters: id - The session id for the session to be returned exception: IllegalStateException - if a new session cannot beinstantiated for any reason exception: IOException - if an input/output error occurs whileprocessing this request
Return the MessageDigest object to be used for calculating
session identifiers. If none has been created yet, initialize
one the first time this method is called.
Return the random number generator instance we should use for
generating session identifiers. If there is no such generator
currently defined, construct and seed a new one.
Returns information about the session with the given session id.
The session information is organized as a HashMap, mapping
session attribute names to the String representation of their values.
Parameters: sessionId - Session id HashMap mapping session attribute names to the Stringrepresentation of their values, or null if no session with thespecified id exists, or if the session does not have any attributes
Set the Container with which this Manager is associated.
Parameters: container - The newly associated Container
setDistributable
public void setDistributable(boolean distributable)(Code)
Set the distributable flag for the sessions supported by this
Manager. If this flag is set, all user data objects added to
sessions associated with this manager must implement Serializable.
Parameters: distributable - The new distributable flag
Use /dev/random-type special device. This is new code, but may reduce
the big delay in generating the random.
You must specify a path to a random generator file. Use /dev/urandom
for linux ( or similar ) systems. Use /dev/random for maximum security
( it may block if not enough "random" exist ). You can also use
a pipe that generates random.
The code will check if the file exists, and default to java Random
if not found. There is a significant performance difference, very
visible on the first call to getSession ( like in the first JSP )
- so use it if available.
setSessionAverageAliveTime
public void setSessionAverageAliveTime(int sessionAverageAliveTime)(Code)
Sets the average time (in seconds) that expired sessions had been
alive.
Parameters: sessionAverageAliveTime - Average time (in seconds) that expiredsessions had been alive.
setSessionCounter
public void setSessionCounter(int sessionCounter)(Code)
setSessionIdLength
public void setSessionIdLength(int idLength)(Code)
Sets the session id length (in bytes) for Sessions created by this
Manager.
Parameters: idLength - The session id length
setSessionMaxAliveTime
public void setSessionMaxAliveTime(int sessionMaxAliveTime)(Code)
Sets the longest time (in seconds) that an expired session had been
alive.
Parameters: sessionMaxAliveTime - Longest time (in seconds) that an expiredsession had been alive.