Package org.apache.catalina.session
Class CookiePersistentManager
- java.lang.Object
-
- org.apache.catalina.session.ManagerBase
-
- org.apache.catalina.session.StandardManager
-
- org.apache.catalina.session.CookiePersistentManager
-
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Lifecycle
,Manager
public class CookiePersistentManager extends StandardManager
Session manager for cookie-based persistence, where cookies carry session state. With cookie-based persistence, only session attribute values of type String are supported.
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.session.StandardManager
lifecycle, name
-
Fields inherited from class org.apache.catalina.session.ManagerBase
container, debug, devRandomSource, distributable, domain, duplicates, entropy, expiredSessions, initialized, log, maxActive, maxActiveUpdateLock, maxInactiveInterval, oname, randomClass, randomIS, rejectedSessions, sessionAverageAliveTime, sessionCounter, sessionIdLength, sessionLocker, sessionMaxAliveTime, sessions, support, uuidGenerator
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description CookiePersistentManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Session session)
Add this Session to the set of active Sessions for this Manager.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.void
clearSessions()
clear out the sessions cache HERCULES:addedSession
findSession(String id, jakarta.servlet.http.HttpServletRequest request)
Gets the session with the given id from the given request.List<Session>
findSessions()
Return the set of active Sessions associated with this Manager.void
remove(Session session)
Remove this Session from the active Sessions for this Manager.void
setCookieName(String cookieName)
jakarta.servlet.http.Cookie
toCookie(Session session)
Converts the given session into a cookie as a way of persisting it.-
Methods inherited from class org.apache.catalina.session.StandardManager
addLifecycleListener, clearStore, createSession, createSession, findLifecycleListeners, getInfo, getMaxActiveSessions, getName, getPathname, getProcessingTime, load, processExpires, propertyChange, readSessions, release, removeLifecycleListener, setContainer, setMaxActiveSessions, setPathname, setProcessingTime, start, stop, stop, unload, unload, writeSessions, writeSessions
-
Methods inherited from class org.apache.catalina.session.ManagerBase
addPropertyChangeListener, changeSessionId, createEmptySession, destroy, expireSession, findSession, findSession, generateSessionId, generateSessionId, getActiveSessions, getClassName, getContainer, getDebug, getDistributable, getDomain, getDuplicates, getEngine, getEntropy, getExpiredSessions, getJvmRoute, getLastAccessedTimeMillis, getMaxActive, getMaxInactiveInterval, getMaxInactiveIntervalSeconds, getNewSession, getObjectName, getRandom, getRandomBytes, getRandomClass, getRandomFile, getRejectedSessions, getSessionAttribute, getSessionAverageAliveTime, getSessionAverageAliveTimeSeconds, getSessionCount, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, getSessionMaxAliveTimeSeconds, getUuidGenerator, init, isSessionVersioningSupported, listSessionIds, lockSession, log, log, postRequestDispatcherProcess, preRequestDispatcherProcess, removePropertyChangeListener, resetRandom, setDebug, setDistributable, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setMaxInactiveIntervalSeconds, setRandomClass, setRandomFile, setRejectedSessions, setSessionAverageAliveTime, setSessionAverageAliveTimeSeconds, setSessionCount, setSessionCounter, setSessionIdLength, setSessionLocker, setSessionMaxAliveTime, setSessionMaxAliveTimeSeconds, setUuidGenerator, unlockSession, update
-
-
-
-
Method Detail
-
setCookieName
public void setCookieName(String cookieName)
-
add
public void add(Session session)
Description copied from class:ManagerBase
Add this Session to the set of active Sessions for this Manager.- Specified by:
add
in interfaceManager
- Overrides:
add
in classManagerBase
- Parameters:
session
- Session to be added
-
findSession
public Session findSession(String id, jakarta.servlet.http.HttpServletRequest request) throws IOException
Description copied from interface:Manager
Gets the session with the given id from the given request.- Specified by:
findSession
in interfaceManager
- Overrides:
findSession
in classManagerBase
- Parameters:
id
- the session idrequest
- the request containing the requested session information- Returns:
- the requested session, or null if not found
- Throws:
IOException
-
clearSessions
public void clearSessions()
Description copied from class:ManagerBase
clear out the sessions cache HERCULES:added- Overrides:
clearSessions
in classManagerBase
-
findSessions
public List<Session> findSessions()
Description copied from interface:Manager
Return the set of active Sessions associated with this Manager. If this Manager has no active Sessions, a empty list is returned.- Specified by:
findSessions
in interfaceManager
- Overrides:
findSessions
in classManagerBase
- Returns:
- associated sessions
-
remove
public void remove(Session session)
Description copied from class:ManagerBase
Remove this Session from the active Sessions for this Manager.- Specified by:
remove
in interfaceManager
- Overrides:
remove
in classManagerBase
- Parameters:
session
- Session to be removed
-
toCookie
public jakarta.servlet.http.Cookie toCookie(Session session) throws IOException
Description copied from interface:Manager
Converts the given session into a cookie as a way of persisting it.- Specified by:
toCookie
in interfaceManager
- Overrides:
toCookie
in classManagerBase
- Parameters:
session
- the session to convert- Returns:
- the cookie representation of the given session
- Throws:
IOException
-
checkSessionAttribute
public void checkSessionAttribute(String name, Object value)
Description copied from interface:Manager
Checks the given session attribute name and value to make sure they comply with any restrictions set forth by this session manager. For example, in the case of cookie-based persistence, session attribute values must be of type String.- Specified by:
checkSessionAttribute
in interfaceManager
- Overrides:
checkSessionAttribute
in classManagerBase
- Parameters:
name
- the session attribute namevalue
- the session attribute value
-
-