Class SessionTrackerFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,jakarta.servlet.FilterConfig,Serializable
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, SessionListener sessionListener) Creates a newSessionTrackerFilter. -
Method Summary
Methods inherited from class jakarta.servlet.http.HttpFilter
doFilterMethods inherited from class jakarta.servlet.GenericFilter
getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, init
-
Constructor Details
-
SessionTrackerFilter
public SessionTrackerFilter(SessionSerializer sessionSerializer, KubernetesKitProperties properties, SessionListener sessionListener) Creates a newSessionTrackerFilter.- Parameters:
sessionSerializer- theSessionSerializerused to serialize and deserialize session dataproperties- theKubernetesKitPropertiesproviding configuration for the filtersessionListener- theSessionListenerinstance that tracks HTTP sessions lifecycle.
-
-
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
-
destroy
public void destroy()
-