public interface Manager
In order for a Manager
implementation to successfully operate
with a Context
implementation that implements reloading, it
must obey the following constraints:
Lifecycle
so that the Context can indicate
that a restart is required.
stop()
to be followed by a call to
start()
on the same Manager
instance.
Modifier and Type | Method and Description |
---|---|
void |
add(Session session)
Add this Session to the set of active Sessions for this Manager.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
changeSessionId(Session session)
Change the session ID of the current session to a new randomly generated
session ID.
|
void |
checkSessionAttribute(String name,
Object value)
Checks the given session attribute name and value to make sure they comply with any
restrictions set forth by this session manager.
|
Session |
createEmptySession()
Get a session from the recycled ones or create a new empty one.
|
Session |
createSession()
Construct and return a new session object, based on the default
settings specified by this Manager's properties.
|
Session |
createSession(String sessionId)
Construct and return a new session object, based on the default
settings specified by this Manager's properties, using the specified
session id.
|
Session |
findSession(String id)
Return the active Session, associated with this Manager, with the
specified session id (if any); otherwise return
null . |
Session |
findSession(String id,
javax.servlet.http.HttpServletRequest request)
Gets the session with the given id from the given request.
|
Session |
findSession(String id,
String version)
Finds and returns the session with the given id that also satisfies
the given version requirement.
|
Session[] |
findSessions()
Return the set of active Sessions associated with this Manager.
|
int |
getActiveSessions()
Gets the number of currently active sessions.
|
Container |
getContainer()
Return the Container with which this Manager is associated.
|
boolean |
getDistributable()
Return the distributable flag for the sessions supported by
this Manager.
|
int |
getExpiredSessions()
Gets the number of sessions that have expired.
|
String |
getInfo()
Return descriptive information about this Manager implementation and
the corresponding version number, in the format
<description>/<version> . |
int |
getMaxActive()
Gets the maximum number of sessions that have been active at the same
time.
|
int |
getMaxInactiveInterval()
Same as getMaxInactiveIntervalSeconds
|
int |
getMaxInactiveIntervalSeconds()
Return the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
int |
getRejectedSessions()
Gets the number of sessions that were not created because the maximum
number of active sessions was reached.
|
int |
getSessionAverageAliveTime()
Same as getSessionAverageAliveTimeSeconds
|
int |
getSessionAverageAliveTimeSeconds()
Gets the average time (in seconds) that expired sessions had been
alive.
|
int |
getSessionCount()
Returns the total number of sessions created by this manager.
|
int |
getSessionCounter()
Same as getSessionCount
|
int |
getSessionIdLength()
Gets the session id length (in bytes) of Sessions created by
this Manager.
|
int |
getSessionMaxAliveTime()
Same as getSessionMaxAliveTimeSeconds
|
int |
getSessionMaxAliveTimeSeconds()
Gets the longest time (in seconds) that an expired session had been
alive.
|
boolean |
isSessionVersioningSupported()
Returns true if this session manager supports session versioning, false
otherwise.
|
void |
load()
Load any currently active sessions that were previously unloaded
to the appropriate persistence mechanism, if any.
|
boolean |
lockSession(javax.servlet.ServletRequest request) |
void |
postRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
void |
preRequestDispatcherProcess(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
void |
remove(Session session)
Remove this Session from the active Sessions for this Manager.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this component.
|
void |
setContainer(Container container)
Set the Container with which this Manager is associated.
|
void |
setDistributable(boolean distributable)
Set the distributable flag for the sessions supported by this
Manager.
|
void |
setExpiredSessions(int expiredSessions)
Sets the number of sessions that have expired.
|
void |
setMaxActive(int maxActive)
(Re)sets the maximum number of sessions that have been active at the
same time.
|
void |
setMaxInactiveInterval(int interval)
Same as setMaxInactiveIntervalSeconds
|
void |
setMaxInactiveIntervalSeconds(int interval)
Set the default maximum inactive interval (in seconds)
for Sessions created by this Manager.
|
void |
setRejectedSessions(int rejectedSessions)
Sets the number of sessions that were not created because the maximum
number of active sessions was reached.
|
void |
setSessionAverageAliveTime(int sessionAverageAliveTime)
Same as setSessionAverageAliveTimeSeconds
|
void |
setSessionAverageAliveTimeSeconds(int sessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been
alive.
|
void |
setSessionCount(int sessionCounter)
Sets the total number of sessions created by this manager.
|
void |
setSessionCounter(int sessionCounter)
Same as setSessionCount
|
void |
setSessionIdLength(int length)
Sets the session id length (in bytes) for Sessions created by this
Manager.
|
void |
setSessionMaxAliveTime(int sessionMaxAliveTime)
Same as setSessionMaxAliveTimeSeconds
|
void |
setSessionMaxAliveTimeSeconds(int sessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been
alive.
|
javax.servlet.http.Cookie |
toCookie(Session session)
Converts the given session into a cookie as a way of persisting it.
|
void |
unload()
Save any currently active sessions in the appropriate persistence
mechanism, if any.
|
void |
unlockSession(javax.servlet.ServletRequest request) |
void |
update(javax.servlet.http.HttpSession session)
Perform any operations when the request is finished.
|
Container getContainer()
void setContainer(Container container)
container
- The newly associated Containerboolean getDistributable()
void setDistributable(boolean distributable)
distributable
- The new distributable flagString getInfo()
<description>/<version>
.int getMaxInactiveInterval()
int getMaxInactiveIntervalSeconds()
void setMaxInactiveInterval(int interval)
void setMaxInactiveIntervalSeconds(int interval)
interval
- The new default valueint getSessionIdLength()
void setSessionIdLength(int length)
length
- The session id lengthint getSessionCounter()
int getSessionCount()
void setSessionCounter(int sessionCounter)
void setSessionCount(int sessionCounter)
sessionCounter
- Total number of sessions created by this manager.int getMaxActive()
void setMaxActive(int maxActive)
maxActive
- Maximum number of sessions that have been active at
the same time.int getActiveSessions()
int getExpiredSessions()
void setExpiredSessions(int expiredSessions)
expiredSessions
- Number of sessions that have expiredint getRejectedSessions()
void setRejectedSessions(int rejectedSessions)
rejectedSessions
- Number of rejected sessionsint getSessionMaxAliveTime()
int getSessionMaxAliveTimeSeconds()
void setSessionMaxAliveTime(int sessionMaxAliveTime)
void setSessionMaxAliveTimeSeconds(int sessionMaxAliveTime)
sessionMaxAliveTime
- Longest time (in seconds) that an expired
session had been alive.int getSessionAverageAliveTime()
int getSessionAverageAliveTimeSeconds()
void setSessionAverageAliveTime(int sessionAverageAliveTime)
void setSessionAverageAliveTimeSeconds(int sessionAverageAliveTime)
sessionAverageAliveTime
- Average time (in seconds) that expired
sessions had been alive.void add(Session session)
session
- Session to be addedvoid addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to addvoid changeSessionId(Session session)
session
- The session to change the session ID forSession createEmptySession()
Session createSession()
null
.IllegalStateException
- if a new session cannot be
instantiated for any reasonSession createSession(String sessionId)
sessionId
- the session id to assign to the new sessionnull
if a session with the
requested id already existsIllegalStateException
- if a new session cannot be
instantiated for any reasonSession findSession(String id) throws IOException
null
.id
- The session id for the session to be returnedIllegalStateException
- if a new session cannot be
instantiated for any reasonIOException
- if an input/output error occurs while
processing this requestSession findSession(String id, String version) throws IOException
id
- The session id to matchversion
- The session version requirement to satisfyIOException
- if an IO error occurredSession findSession(String id, javax.servlet.http.HttpServletRequest request) throws IOException
id
- the session idrequest
- the request containing the requested session informationIOException
boolean isSessionVersioningSupported()
Session[] findSessions()
void load() throws ClassNotFoundException, IOException
ClassNotFoundException
- if a serialized class cannot be
found during the reloadIOException
- if an input/output error occursvoid remove(Session session)
session
- Session to be removedvoid removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to removevoid unload() throws IOException
IOException
- if an input/output error occursvoid update(javax.servlet.http.HttpSession session) throws Exception
Exception
boolean lockSession(javax.servlet.ServletRequest request) throws javax.servlet.ServletException
javax.servlet.ServletException
void unlockSession(javax.servlet.ServletRequest request)
void preRequestDispatcherProcess(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
void postRequestDispatcherProcess(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
javax.servlet.http.Cookie toCookie(Session session) throws IOException
session
- the session to convertIOException
void checkSessionAttribute(String name, Object value) throws IllegalArgumentException
name
- the session attribute namevalue
- the session attribute valueIllegalArgumentException
- if the given session attribute name or value violate
any restrictions set forth by this session managerCopyright © 2018. All rights reserved.