Class SessionListener
java.lang.Object
com.vaadin.kubernetes.starter.sessiontracker.SessionListener
- All Implemented Interfaces:
jakarta.servlet.http.HttpSessionListener
,EventListener
An
HttpSessionListener
implementation that handles population and
destruction of session data stored on a distributed storage.
In presence of a tracking Cookie set by SessionTrackerFilter
, on
session creation, the distributed storage is queried for persisted attributes
that are then used to populate the newly created HttpSession
.
Data is fetched in binary format from the distributed storage by a
BackendConnector
and then deserialized and copied into HTTP session
by SessionSerializer
.
When HTTP session is destroyed, also relative data on distribute storage is
deleted by the backend connector.-
Constructor Summary
ConstructorDescriptionSessionListener
(BackendConnector sessionBackendConnector, SessionSerializer sessionSerializer) Creates a newSessionListener
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
sessionCreated
(jakarta.servlet.http.HttpSessionEvent se) void
sessionDestroyed
(jakarta.servlet.http.HttpSessionEvent se)
-
Constructor Details
-
SessionListener
public SessionListener(BackendConnector sessionBackendConnector, SessionSerializer sessionSerializer) Creates a newSessionListener
instance.- Parameters:
sessionBackendConnector
- backend connector to fetch and delete session data from distributed storage.sessionSerializer
- component to perform deserialization of data from distributed storage.
-
-
Method Details
-
sessionCreated
public void sessionCreated(jakarta.servlet.http.HttpSessionEvent se) - Specified by:
sessionCreated
in interfacejakarta.servlet.http.HttpSessionListener
-
sessionDestroyed
public void sessionDestroyed(jakarta.servlet.http.HttpSessionEvent se) - Specified by:
sessionDestroyed
in interfacejakarta.servlet.http.HttpSessionListener
-