Class AbstractMessageDispatcherServletInitializer

java.lang.Object
org.springframework.web.context.AbstractContextLoaderInitializer
org.springframework.ws.transport.http.support.AbstractMessageDispatcherServletInitializer
All Implemented Interfaces:
org.springframework.web.WebApplicationInitializer
Direct Known Subclasses:
AbstractAnnotationConfigMessageDispatcherServletInitializer

public abstract class AbstractMessageDispatcherServletInitializer extends org.springframework.web.context.AbstractContextLoaderInitializer
Base class for 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.

Since:
2.2
Author:
Arjen Poutsma
  • Field Details

    • DEFAULT_SERVLET_NAME

      public static final String DEFAULT_SERVLET_NAME
      The default servlet name. Can be customized by overriding getServletName().
      See Also:
    • DEFAULT_SERVLET_MAPPINGS

      public static final String[] DEFAULT_SERVLET_MAPPINGS
      The default servlet mappings. Can be customized by overriding getServletMappings().
  • Constructor Details

    • AbstractMessageDispatcherServletInitializer

      public AbstractMessageDispatcherServletInitializer()
  • Method Details

    • onStartup

      public void onStartup(jakarta.servlet.ServletContext servletContext) throws jakarta.servlet.ServletException
      Specified by:
      onStartup in interface org.springframework.web.WebApplicationInitializer
      Overrides:
      onStartup in class org.springframework.web.context.AbstractContextLoaderInitializer
      Throws:
      jakarta.servlet.ServletException
    • registerMessageDispatcherServlet

      protected void registerMessageDispatcherServlet(jakarta.servlet.ServletContext servletContext)
      Register a 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).

      Parameters:
      servletContext - the context to register the servlet against
    • getServletName

      protected String getServletName()
      Return the name under which the MessageDispatcherServlet will be registered. Defaults to DEFAULT_SERVLET_NAME.
      See Also:
    • createServletApplicationContext

      protected abstract org.springframework.web.context.WebApplicationContext createServletApplicationContext()
      Create a servlet application context to be provided to the MessageDispatcherServlet.

      The returned context is delegated to Spring's MessageDispatcherServlet(WebApplicationContext). As such, it typically contains endpoints, interceptors and other web service-related beans.

      See Also:
    • getServletMappings

      protected String[] getServletMappings()
      Specify the servlet mapping(s) for the MessageDispatcherServlet. Defaults to DEFAULT_SERVLET_MAPPINGS.
      See Also:
    • isTransformWsdlLocations

      public boolean isTransformWsdlLocations()
      Indicates whether relative address locations in the WSDL are to be transformed using the request URI of the incoming HTTP request. Defaults to false.
    • isTransformSchemaLocations

      protected boolean isTransformSchemaLocations()
      Indicates whether relative address locations in the XSD are to be transformed using the request URI of the incoming HTTP request. Defaults to false.
    • customizeRegistration

      protected void customizeRegistration(jakarta.servlet.ServletRegistration.Dynamic registration)
      Optionally perform further registration customization once registerMessageDispatcherServlet(ServletContext) has completed.
      Parameters:
      registration - the MessageDispatcherServlet registration to be customized
      See Also: