Package net.bull.javamelody
Class SessionListener
java.lang.Object
net.bull.javamelody.SessionListener
- All Implemented Interfaces:
Serializable,EventListener,HttpSessionActivationListener,HttpSessionListener,ServletContextListener
public class SessionListener
extends Object
implements HttpSessionListener, HttpSessionActivationListener, ServletContextListener, Serializable
Listener de session http (
HttpSessionListener) pour le monitoring.
C'est la classe de ce listener qui doit être déclarée dans le fichier web.xml de la webapp.
Ce listener fait également listener de contexte de servlet (ServletContextListener)
et listener de passivation/activation de sessions (HttpSessionActivationListener).- Author:
- Emeric Vernat
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindSession(HttpSession session) Définit la session http pour le thread courant.voidvoidstatic List<SessionInformations>static HttpSessionRetourne la session pour le thread courant ou null.static longstatic intstatic SessionInformationsgetSessionInformationsBySessionId(String sessionId) static voidinvalidateAllSessionsExceptCurrentSession(HttpSession currentSession) static voidinvalidateSession(String sessionId) voidsessionCreated(HttpSessionEvent event) voidsessionDestroyed(HttpSessionEvent event) voidvoidstatic voidsortSessions(List<SessionInformations> sessionsInformations) toString()static voidEnlève le lien entre la session et le thread courant.
-
Field Details
-
CSRF_TOKEN_SESSION_NAME
-
SESSION_COUNTRY_KEY
- See Also:
-
SESSION_REMOTE_ADDR
- See Also:
-
SESSION_REMOTE_USER
- See Also:
-
SESSION_USER_AGENT
- See Also:
-
-
Constructor Details
-
SessionListener
public SessionListener()Constructeur. -
SessionListener
public SessionListener(boolean instanceEnabled) Constructeur.- Parameters:
instanceEnabled- boolean
-
-
Method Details
-
getSessionCount
public static int getSessionCount() -
getSessionAgeSum
public static long getSessionAgeSum() -
invalidateAllSessionsExceptCurrentSession
-
invalidateSession
-
getAllSessionsInformations
-
sortSessions
-
getSessionInformationsBySessionId
-
bindSession
Définit la session http pour le thread courant.- Parameters:
session- HttpSession
-
getCurrentSession
Retourne la session pour le thread courant ou null.- Returns:
- HttpSession
-
unbindSession
public static void unbindSession()Enlève le lien entre la session et le thread courant. -
contextInitialized
- Specified by:
contextInitializedin interfaceServletContextListener
-
contextDestroyed
- Specified by:
contextDestroyedin interfaceServletContextListener
-
sessionCreated
- Specified by:
sessionCreatedin interfaceHttpSessionListener
-
sessionDestroyed
- Specified by:
sessionDestroyedin interfaceHttpSessionListener
-
sessionDidActivate
- Specified by:
sessionDidActivatein interfaceHttpSessionActivationListener
-
sessionWillPassivate
- Specified by:
sessionWillPassivatein interfaceHttpSessionActivationListener
-
toString
-