Class SessionTrackerFilter
java.lang.Object
jakarta.servlet.GenericFilter
jakarta.servlet.http.HttpFilter
com.vaadin.kubernetes.starter.sessiontracker.SessionTrackerFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,jakarta.servlet.FilterConfig,Serializable
public class SessionTrackerFilter
extends jakarta.servlet.http.HttpFilter
An HTTP filter implementation that serializes and persists HTTP session on a
distributed storage at the end of the request.
This filter uses a
SessionSerializer component to serialize and
persist the HTTP session. Furthermore, it should be used in combination with
SessionListener, the component responsible for retrieve the session
attributes from the distributed storage and populate the HTTP session.
A unique identifier is assigned to valid HTTP sessions and sent to the client
as a tracking HTTP Cookie. The same identifier is used to associate the
session within the distributed storage.
If the HTTP request has not a valid session but the tracking Cookie exists,
the filter forces the creation of a new HTTP session, that is then populated
with data from the distributed storage by SessionListener.
The filter acts only on requests handled by Vaadin Flow.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSessionTrackerFilter(SessionSerializer sessionSerializer, KubernetesKitProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilter(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) Methods inherited from class jakarta.servlet.http.HttpFilter
doFilterMethods inherited from class jakarta.servlet.GenericFilter
getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, initMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.Filter
destroy
-
Constructor Details
-
SessionTrackerFilter
public SessionTrackerFilter(SessionSerializer sessionSerializer, KubernetesKitProperties properties)
-
-
Method Details
-
doFilter
protected void doFilter(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Overrides:
doFilterin classjakarta.servlet.http.HttpFilter- Throws:
IOExceptionjakarta.servlet.ServletException
-