DefaultServletHandlerConfigurer (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.web.servlet.config.annotation

## Class DefaultServletHandlerConfigurer

- java.lang.Object
- - org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer

-     public class DefaultServletHandlerConfigurer
      extends Object

  Configures a request handler for serving static resources by forwarding the request to the Servlet container's "default" Servlet. This is intended to be used when the Spring MVC `DispatcherServlet` is mapped to "/" thus overriding the Servlet container's default handling of static resources. Since this handler is configured at the lowest precedence, effectively it allows all other handler mappings to handle the request, and if none of them do, this handler can forward it to the "default" Servlet.
  Since:
    3.1
  Author:
    Rossen Stoyanchev
  See Also:
    `DefaultServletHttpRequestHandler`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultServletHandlerConfigurer(ServletContext servletContext)` Create a `DefaultServletHandlerConfigurer` instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enable()` Enable forwarding to the "default" Servlet.
    `void` | `enable(String defaultServletName)` Enable forwarding to the "default" Servlet identified by the given name.
    `protected AbstractHandlerMapping` | `getHandlerMapping()` Return a handler mapping instance ordered at `Integer.MAX_VALUE` containing the `DefaultServletHttpRequestHandler` instance mapped to `"/**"`; or `null` if default servlet handling was not been enabled.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultServletHandlerConfigurer

          public DefaultServletHandlerConfigurer(ServletContext servletContext)

      Create a `DefaultServletHandlerConfigurer` instance.
      Parameters:
        `servletContext` - the ServletContext to use to configure the underlying DefaultServletHttpRequestHandler.

  - ### Method Detail

    - #### enable

          public void enable()

      Enable forwarding to the "default" Servlet. When this method is used the `DefaultServletHttpRequestHandler` will try to auto-detect the "default" Servlet name. Alternatively, you can specify the name of the default Servlet via `enable(String)`.
      See Also:
        `DefaultServletHttpRequestHandler`

    - #### enable

          public void enable(String defaultServletName)

      Enable forwarding to the "default" Servlet identified by the given name. This is useful when the default Servlet cannot be auto-detected, for example when it has been manually configured.
      See Also:
        `DefaultServletHttpRequestHandler`

    - #### getHandlerMapping

          protected AbstractHandlerMapping getHandlerMapping()

      Return a handler mapping instance ordered at `Integer.MAX_VALUE` containing the `DefaultServletHttpRequestHandler` instance mapped to `"/**"`; or `null` if default servlet handling was not been enabled.