@Order(value=100) public abstract class AbstractHttpSessionApplicationInitializer extends Object implements org.springframework.web.WebApplicationInitializer
DelegatingFilterProxy to use the
springSessionRepositoryFilter before any other registered Filter. When
used with AbstractHttpSessionApplicationInitializer(Class...), it
will also register a ContextLoaderListener. When used with
AbstractHttpSessionApplicationInitializer(), this class is typically
used in addition to a subclass of AbstractContextLoaderInitializer.
By default the DelegatingFilterProxy is registered with support for
asynchronous requests, but can be enabled by overriding isAsyncSessionSupported() and
getSessionDispatcherTypes().
Additional configuration before and after the springSecurityFilterChain can
be added by overriding
afterSessionRepositoryFilter(ServletContext).
Subclasses of AbstractDispatcherServletInitializer will register their
filters before any other Filter. This means that you will typically
want to ensure subclasses of AbstractDispatcherServletInitializer are invoked
first. This can be done by ensuring the Order or Ordered of
AbstractDispatcherServletInitializer are sooner than subclasses of
AbstractSecurityWebApplicationInitializer.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_FILTER_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractHttpSessionApplicationInitializer()
Creates a new instance that assumes the Spring Session configuration is
loaded by some other means than this class.
|
protected |
AbstractHttpSessionApplicationInitializer(Class<?>... configurationClasses)
Creates a new instance that will instantiate the
ContextLoaderListener with the specified classes. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterSessionRepositoryFilter(ServletContext servletContext)
Invoked after the springSessionRepositoryFilter is added.
|
protected void |
appendFilters(ServletContext servletContext,
Filter... filters)
Inserts the provided
Filters after existing Filters
using default generated names, getSessionDispatcherTypes(), and
isAsyncSessionSupported(). |
protected void |
beforeSessionRepositoryFilter(ServletContext servletContext)
Invoked before the springSessionRepositoryFilter is added.
|
protected String |
getDispatcherWebApplicationContextSuffix()
Return the
<servlet-name> to use the DispatcherServlet's
WebApplicationContext to find the DelegatingFilterProxy
or null to use the parent ApplicationContext. |
protected EnumSet<DispatcherType> |
getSessionDispatcherTypes()
Get the
DispatcherType for the springSessionRepositoryFilter. |
protected void |
insertFilters(ServletContext servletContext,
Filter... filters)
Inserts the provided
Filters before existing Filters
using default generated names, getSessionDispatcherTypes(), and
isAsyncSessionSupported(). |
protected boolean |
isAsyncSessionSupported()
Determine if the springSessionRepositoryFilter should be marked as supporting
asynch.
|
void |
onStartup(ServletContext servletContext) |
public static final String DEFAULT_FILTER_NAME
protected AbstractHttpSessionApplicationInitializer()
ContextLoaderListener using a subclass of
AbstractContextLoaderInitializer.ContextLoaderListenerprotected AbstractHttpSessionApplicationInitializer(Class<?>... configurationClasses)
ContextLoaderListener with the specified classes.configurationClasses - @Configuration classes that will be used to configure the contextpublic void onStartup(ServletContext servletContext) throws ServletException
onStartup in interface org.springframework.web.WebApplicationInitializerServletExceptionprotected final void insertFilters(ServletContext servletContext, Filter... filters)
Filters before existing Filters
using default generated names, getSessionDispatcherTypes(), and
isAsyncSessionSupported().servletContext - the ServletContext to usefilters - the Filters to registerprotected final void appendFilters(ServletContext servletContext, Filter... filters)
Filters after existing Filters
using default generated names, getSessionDispatcherTypes(), and
isAsyncSessionSupported().servletContext - the ServletContext to usefilters - the Filters to registerprotected String getDispatcherWebApplicationContextSuffix()
<servlet-name> to use the DispatcherServlet's
WebApplicationContext to find the DelegatingFilterProxy
or null to use the parent ApplicationContext.
For example, if you are using AbstractDispatcherServletInitializer or
AbstractAnnotationConfigDispatcherServletInitializer and using the
provided Servlet name, you can return "dispatcher" from this method to
use the DispatcherServlet's WebApplicationContext.
<servlet-name> of the DispatcherServlet to use its
WebApplicationContext or null (default) to use the parent
ApplicationContext.protected void beforeSessionRepositoryFilter(ServletContext servletContext)
servletContext - the ServletContextprotected void afterSessionRepositoryFilter(ServletContext servletContext)
servletContext - the ServletContextprotected EnumSet<DispatcherType> getSessionDispatcherTypes()
DispatcherType for the springSessionRepositoryFilter.DispatcherType for the filterprotected boolean isAsyncSessionSupported()