AbstractReactiveWebInitializer
@Deprecated public abstract class AbstractDispatcherHandlerInitializer extends Object implements WebApplicationInitializer
WebApplicationInitializer
implementations that register a DispatcherHandler
in the servlet
context, wrapping it in a ServletHttpHandlerAdapter
.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SERVLET_MAPPING
Deprecated.
The default servlet mapping.
|
static String |
DEFAULT_SERVLET_NAME
Deprecated.
The default servlet name.
|
Constructor and Description |
---|
AbstractDispatcherHandlerInitializer()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ApplicationContext |
createApplicationContext()
Deprecated.
Create an application context to be provided to the
DispatcherHandler . |
protected WebHandler |
createDispatcherHandler(ApplicationContext applicationContext)
Deprecated.
Create a
DispatcherHandler (or other kind of WebHandler -derived
dispatcher) with the specified ApplicationContext . |
protected ServletHttpHandlerAdapter |
createHandlerAdapter(WebHandler webHandler)
Deprecated.
Create a
ServletHttpHandlerAdapter . |
protected void |
customizeRegistration(ServletRegistration.Dynamic registration)
Deprecated.
Optionally perform further registration customization once
registerDispatcherHandler(ServletContext) has completed. |
protected String |
getServletMapping()
Deprecated.
Specify the servlet mapping for the
ServletHttpHandlerAdapter . |
protected String |
getServletName()
Deprecated.
Return the name under which the
ServletHttpHandlerAdapter will be registered. |
void |
onStartup(ServletContext servletContext)
Deprecated.
Configure the given
ServletContext with any servlets, filters, listeners
context-params and attributes necessary for initializing this web application. |
protected void |
refreshApplicationContext(ApplicationContext context)
Deprecated.
Refresh the given application context, if necessary.
|
protected void |
registerCloseListener(ServletContext servletContext,
ApplicationContext applicationContext)
Deprecated.
Register a
ServletContextListener that closes the given application context
when the servlet context is destroyed. |
protected void |
registerDispatcherHandler(ServletContext servletContext)
Deprecated.
Register a
DispatcherHandler against the given servlet context. |
public static final String DEFAULT_SERVLET_NAME
getServletName()
.public static final String DEFAULT_SERVLET_MAPPING
getServletMapping()
.public AbstractDispatcherHandlerInitializer()
public void onStartup(ServletContext servletContext) throws ServletException
WebApplicationInitializer
ServletContext
with any servlets, filters, listeners
context-params and attributes necessary for initializing this web application. See
examples above.onStartup
in interface WebApplicationInitializer
servletContext
- the ServletContext
to initializeServletException
- if any call against the given ServletContext
throws a ServletException
protected void registerDispatcherHandler(ServletContext servletContext)
DispatcherHandler
against the given servlet context.
This method will create a DispatcherHandler
, initializing it with the application
context returned from createApplicationContext()
. The created handler will be
wrapped in a ServletHttpHandlerAdapter
servlet with the name
returned by getServletName()
, mapping it to the pattern
returned from getServletMapping()
.
Further customization can be achieved by overriding customizeRegistration(ServletRegistration.Dynamic)
or
createDispatcherHandler(ApplicationContext)
.
servletContext
- the context to register the servlet againstprotected String getServletName()
ServletHttpHandlerAdapter
will be registered.
Defaults to DEFAULT_SERVLET_NAME
.protected abstract ApplicationContext createApplicationContext()
DispatcherHandler
.
The returned context is delegated to Spring's
DispatcherHandler.DispatcherHandler(ApplicationContext)
. As such,
it typically contains controllers, view resolvers, and other web-related beans.
protected void refreshApplicationContext(ApplicationContext context)
protected WebHandler createDispatcherHandler(ApplicationContext applicationContext)
DispatcherHandler
(or other kind of WebHandler
-derived
dispatcher) with the specified ApplicationContext
.protected ServletHttpHandlerAdapter createHandlerAdapter(WebHandler webHandler)
ServletHttpHandlerAdapter
.
Default implementation returns a ServletHttpHandlerAdapter
with the provided
webHandler
.
protected String getServletMapping()
ServletHttpHandlerAdapter
.
Default implementation returns /
.
protected void customizeRegistration(ServletRegistration.Dynamic registration)
registerDispatcherHandler(ServletContext)
has completed.registration
- the ServletHttpHandlerAdapter
registration to be customizedregisterDispatcherHandler(ServletContext)
protected void registerCloseListener(ServletContext servletContext, ApplicationContext applicationContext)
ServletContextListener
that closes the given application context
when the servlet context is destroyed.servletContext
- the servlet context to listen toapplicationContext
- the application context that is to be closed when
servletContext
is destroyed