public class DefaultServletHandlerConfigurer extends Object
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.DefaultServletHttpRequestHandler
Constructor and Description |
---|
DefaultServletHandlerConfigurer(ServletContext servletContext)
Create a
DefaultServletHandlerConfigurer instance. |
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. |
public DefaultServletHandlerConfigurer(ServletContext servletContext)
DefaultServletHandlerConfigurer
instance.servletContext
- the ServletContext to use to configure the underlying DefaultServletHttpRequestHandler.public void enable()
DefaultServletHttpRequestHandler
will try to auto-detect the "default" Servlet name. Alternatively, you can specify the name of the default
Servlet via enable(String)
.DefaultServletHttpRequestHandler
public void enable(String defaultServletName)
DefaultServletHttpRequestHandler
protected AbstractHandlerMapping getHandlerMapping()
Integer.MAX_VALUE
containing the
DefaultServletHttpRequestHandler
instance mapped to "/**"
; or null
if
default servlet handling was not been enabled.