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 voidadd(Session session)Add this Session to the set of active Sessions for this Manager.voidcheckSessionAttribute(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.voidclearSessions()clear out the sessions cache HERCULES:addedSessionfindSession(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.voidremove(Session session)Remove this Session from the active Sessions for this Manager.voidsetCookieName(String cookieName)jakarta.servlet.http.CookietoCookie(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:ManagerBaseAdd this Session to the set of active Sessions for this Manager.- Specified by:
addin interfaceManager- Overrides:
addin classManagerBase- Parameters:
session- Session to be added
-
findSession
public Session findSession(String id, jakarta.servlet.http.HttpServletRequest request) throws IOException
Description copied from interface:ManagerGets the session with the given id from the given request.- Specified by:
findSessionin interfaceManager- Overrides:
findSessionin 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:ManagerBaseclear out the sessions cache HERCULES:added- Overrides:
clearSessionsin classManagerBase
-
findSessions
public List<Session> findSessions()
Description copied from interface:ManagerReturn the set of active Sessions associated with this Manager. If this Manager has no active Sessions, a empty list is returned.- Specified by:
findSessionsin interfaceManager- Overrides:
findSessionsin classManagerBase- Returns:
- associated sessions
-
remove
public void remove(Session session)
Description copied from class:ManagerBaseRemove this Session from the active Sessions for this Manager.- Specified by:
removein interfaceManager- Overrides:
removein classManagerBase- Parameters:
session- Session to be removed
-
toCookie
public jakarta.servlet.http.Cookie toCookie(Session session) throws IOException
Description copied from interface:ManagerConverts the given session into a cookie as a way of persisting it.- Specified by:
toCookiein interfaceManager- Overrides:
toCookiein 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:ManagerChecks 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:
checkSessionAttributein interfaceManager- Overrides:
checkSessionAttributein classManagerBase- Parameters:
name- the session attribute namevalue- the session attribute value
-
-