public abstract class AbstractMessageDispatcherServletInitializer extends 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.
|
logger
Constructor and Description |
---|
AbstractMessageDispatcherServletInitializer() |
Modifier and Type | Method and Description |
---|---|
protected abstract WebApplicationContext |
createServletApplicationContext()
Create a servlet application context to be provided to the
MessageDispatcherServlet . |
protected void |
customizeRegistration(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(ServletContext servletContext) |
protected void |
registerMessageDispatcherServlet(ServletContext servletContext)
Register a
MessageDispatcherServlet against the given servlet context. |
createRootApplicationContext, registerContextLoaderListener
public static final String DEFAULT_SERVLET_NAME
getServletName()
.public static final String[] DEFAULT_SERVLET_MAPPINGS
getServletMappings()
.public AbstractMessageDispatcherServletInitializer()
public void onStartup(ServletContext servletContext) throws ServletException
onStartup
in interface WebApplicationInitializer
onStartup
in class AbstractContextLoaderInitializer
ServletException
protected void registerMessageDispatcherServlet(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 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(ServletRegistration.Dynamic registration)
registerMessageDispatcherServlet(ServletContext)
has completed.registration
- the MessageDispatcherServlet
registration to be customizedregisterMessageDispatcherServlet(ServletContext)