public abstract class AbstractJohnsonDispatcherServletInitializer
extends org.springframework.web.servlet.support.AbstractDispatcherServletInitializer
AbstractDispatcherServletInitializer to use Johnson-aware components.
JohnsonContextListener will be registered before any other listeners that are registered
by this initializerJohnsonContextLoaderListener will be used to initialize the root ApplicationContext, if one is createdJohnsonDispatcherServlet will be used to initialize the servlet ApplicationContext
In addition to using Johnson-aware components by default, this base class allows derived initializers to override
the ContextLoaderListener and
DispatcherServlet types used. This is intended to allow
for application-specific handling on top of the Johnson-aware handling.
| Constructor and Description |
|---|
AbstractJohnsonDispatcherServletInitializer() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.web.context.ContextLoaderListener |
createContextLoaderListener(org.springframework.web.context.WebApplicationContext context)
Creates a
JohnsonContextLoaderListener which will initialize and terminate the provided
WebApplicationContext. |
protected org.springframework.web.servlet.DispatcherServlet |
createDispatcherServlet(org.springframework.web.context.WebApplicationContext context)
Creates a
JohnsonDispatcherServlet, which will initialize the SpringMVC context in a Johnson-aware
away. |
void |
onStartup(javax.servlet.ServletContext servletContext)
Registers a JohnsonContextListener and then
delegates to the superclass's onStartup(ServletContext) implementation. |
protected void |
registerContextLoaderListener(javax.servlet.ServletContext servletContext)
Overrides
AbstractContextLoaderListener's registerContextLoaderListener to register a
JohnsonContextLoaderListener instead of the
standard Spring ContextLoaderListener. |
protected void |
registerDispatcherServlet(javax.servlet.ServletContext servletContext)
Overrides
AbstractDispatcherServletInitializer's registerDispatcherServlet(ServletContext) to
register a JohnsonDispatcherServlet instead of the
standard Spring DispatcherServlet. |
protected void |
registerJohnsonContextListener(javax.servlet.ServletContext servletContext)
Registers an
JohnsonContextListener in in the provided ServletContext. |
createServletApplicationContext, customizeRegistration, getServletFilters, getServletMappings, getServletName, isAsyncSupported, registerServletFilterpublic AbstractJohnsonDispatcherServletInitializer()
protected org.springframework.web.context.ContextLoaderListener createContextLoaderListener(org.springframework.web.context.WebApplicationContext context)
JohnsonContextLoaderListener which will initialize and terminate the provided
WebApplicationContext. This method is provided as a convenience for derived classes to
simplify replacing the listener used.context - the WebApplicationContext to be initialized by the created listenerServletContextprotected org.springframework.web.servlet.DispatcherServlet createDispatcherServlet(org.springframework.web.context.WebApplicationContext context)
JohnsonDispatcherServlet, which will initialize the SpringMVC context in a Johnson-aware
away. If SpringMVC initialization fails, the application will be locked.context - the WebApplicationContext to be initialized by the created dispatcherServletContextpublic void onStartup(javax.servlet.ServletContext servletContext)
throws javax.servlet.ServletException
Registers a JohnsonContextListener and then
delegates to the superclass's onStartup(ServletContext) implementation.onStartup in interface org.springframework.web.WebApplicationInitializeronStartup in class org.springframework.web.servlet.support.AbstractDispatcherServletInitializerservletContext - the ServletContext to initializejavax.servlet.ServletException - potentially thrown by the superclass onStartup(ServletContext) implementationprotected void registerContextLoaderListener(javax.servlet.ServletContext servletContext)
AbstractContextLoaderListener's registerContextLoaderListener to register a
JohnsonContextLoaderListener instead of the
standard Spring ContextLoaderListener.registerContextLoaderListener in class org.springframework.web.context.AbstractContextLoaderInitializerservletContext - the ServletContext to register the JohnsonContextLoaderListener inprotected void registerDispatcherServlet(javax.servlet.ServletContext servletContext)
AbstractDispatcherServletInitializer's registerDispatcherServlet(ServletContext) to
register a JohnsonDispatcherServlet instead of the
standard Spring DispatcherServlet.registerDispatcherServlet in class org.springframework.web.servlet.support.AbstractDispatcherServletInitializerservletContext - the ServletContext to register the JohnsonDispatcherServlet inprotected void registerJohnsonContextListener(javax.servlet.ServletContext servletContext)
JohnsonContextListener in in the provided ServletContext. This listener ensures
Johnson is initialized and terminated with the application.
Note: Even if this method is called multiple times, with its default implementation the listener will only be added once.
servletContext - the ServletContext to register the JohnsonContextListener inJohnsonContextListener.register(ServletContext)Copyright © 2017 Atlassian. All rights reserved.