Top Description Constructors Methods
org.apache.catalina.filters

public Class SessionInitializerFilter

extends Object
implements Filter
Class Inheritance
All Implemented Interfaces
jakarta.servlet.Filter
Imports
java.io.IOException, jakarta.servlet.Filter, .FilterChain, .ServletException, .ServletRequest, .ServletResponse, jakarta.servlet.http.HttpServletRequest, .HttpSession

A jakarta.servlet.Filter that initializes the HttpSession for the HttpServletRequest by calling its getSession() method.

This is required for some operations with WebSocket requests, where it is too late to initialize the HttpSession object, and the current Java WebSocket specification does not provide a way to do so.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
doFilter(ServletRequest
The request to process
request
,
ServletResponse
The response associated with the request
response
,
FilterChain
Provides access to the next filter in the chain for this filter to pass the request and response to for further processing
chain
)

Implements jakarta.servlet.Filter.doFilter.

Calls HttpServletRequest's getSession() to initialize the HttpSession and continues processing the chain.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SessionInitializerFilterback to summary
public SessionInitializerFilter()

Method Detail

doFilterback to summary
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException

Implements jakarta.servlet.Filter.doFilter.

Calls HttpServletRequest's getSession() to initialize the HttpSession and continues processing the chain.

Parameters
request:ServletRequest

The request to process

response:ServletResponse

The response associated with the request

chain:FilterChain

Provides access to the next filter in the chain for this filter to pass the request and response to for further processing

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs during this filter's processing of the request
ServletException:
if the processing fails for any other reason