public abstract class AbstractMessageDispatcherServletInitializer
extends org.springframework.web.context.AbstractContextLoaderInitializer
WebApplicationInitializer
implementations that register a
MessageDispatcherServlet
in the servlet context.
Concrete implementations are required to implement createServletApplicationContext()
, which gets invoked from
registerMessageDispatcherServlet(ServletContext)
. Further customization can be
achieved by overriding customizeRegistration(ServletRegistration.Dynamic)
.
Because this class extends from AbstractContextLoaderInitializer
, concrete
implementations are also required to implement AbstractContextLoaderInitializer.createRootApplicationContext()
to set up a parent "root" application context. If a root context is
not desired, implementations can simply return null
in the
createRootApplicationContext()
implementation.
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_SERVLET_MAPPINGS
The default servlet mappings.
|
static String |
DEFAULT_SERVLET_NAME
The default servlet name.
|
Constructor and Description |
---|
AbstractMessageDispatcherServletInitializer() |
Modifier and Type | Method and Description |
---|---|
protected abstract org.springframework.web.context.WebApplicationContext |
createServletApplicationContext()
Create a servlet application context to be provided to the
MessageDispatcherServlet . |
protected void |
customizeRegistration(javax.servlet.ServletRegistration.Dynamic registration)
Optionally perform further registration customization once
registerMessageDispatcherServlet(ServletContext) has completed. |
protected String[] |
getServletMappings()
Specify the servlet mapping(s) for the
MessageDispatcherServlet . |
protected String |
getServletName()
Return the name under which the
MessageDispatcherServlet will be registered. |
protected boolean |
isTransformSchemaLocations()
Indicates whether relative address locations in the XSD are to be transformed using
the request URI of the incoming HTTP request.
|
boolean |
isTransformWsdlLocations()
Indicates whether relative address locations in the WSDL are to be transformed
using the request URI of the incoming HTTP request.
|
void |
onStartup(javax.servlet.ServletContext servletContext) |
protected void |
registerMessageDispatcherServlet(javax.servlet.ServletContext servletContext)
Register a
MessageDispatcherServlet against the given servlet context. |
public static final String DEFAULT_SERVLET_NAME
getServletName()
.public static final String[] DEFAULT_SERVLET_MAPPINGS
getServletMappings()
.public AbstractMessageDispatcherServletInitializer()
public void onStartup(javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException
onStartup
in interface org.springframework.web.WebApplicationInitializer
onStartup
in class org.springframework.web.context.AbstractContextLoaderInitializer
javax.servlet.ServletException
protected void registerMessageDispatcherServlet(javax.servlet.ServletContext servletContext)
MessageDispatcherServlet
against the given servlet context.
This method will create a MessageDispatcherServlet
with the name
returned by getServletName()
, initializing it with the application context
returned from createServletApplicationContext()
, and mapping it to the
patterns returned from getServletMappings()
.
Further customization can be achieved by overriding customizeRegistration(ServletRegistration.Dynamic)
.
servletContext
- the context to register the servlet againstprotected String getServletName()
MessageDispatcherServlet
will be registered.
Defaults to DEFAULT_SERVLET_NAME
.protected abstract org.springframework.web.context.WebApplicationContext createServletApplicationContext()
MessageDispatcherServlet
.
The returned context is delegated to Spring's
MessageDispatcherServlet.MessageDispatcherServlet(WebApplicationContext)
.
As such, it typically contains endpoints, interceptors and other
web service-related beans.
protected String[] getServletMappings()
MessageDispatcherServlet
.
Defaults to DEFAULT_SERVLET_MAPPINGS
.public boolean isTransformWsdlLocations()
false
.protected boolean isTransformSchemaLocations()
false
.protected void customizeRegistration(javax.servlet.ServletRegistration.Dynamic registration)
registerMessageDispatcherServlet(ServletContext)
has completed.registration
- the MessageDispatcherServlet
registration to be customizedregisterMessageDispatcherServlet(ServletContext)
Copyright © 2020 Pivotal Software. All rights reserved.