public class DefaultServletHandlerConfigurer
extends java.lang.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 |
---|---|
protected SimpleUrlHandlerMapping |
buildHandlerMapping()
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. |
void |
enable()
Enable forwarding to the "default" Servlet.
|
void |
enable(java.lang.String defaultServletName)
Enable forwarding to the "default" Servlet identified by the given name.
|
protected AbstractHandlerMapping |
getHandlerMapping()
Deprecated.
as of 4.3.12, in favor of
buildHandlerMapping() |
public DefaultServletHandlerConfigurer(ServletContext servletContext)
DefaultServletHandlerConfigurer
instance.servletContext
- the ServletContext to use.public void enable()
When this method is used the DefaultServletHttpRequestHandler
will try to autodetect the "default" Servlet name. Alternatively, you can
specify the name of the default Servlet via enable(String)
.
DefaultServletHttpRequestHandler
public void enable(java.lang.String defaultServletName)
This is useful when the default Servlet cannot be autodetected, for example when it has been manually configured.
DefaultServletHttpRequestHandler
protected SimpleUrlHandlerMapping buildHandlerMapping()
Integer.MAX_VALUE
containing the
DefaultServletHttpRequestHandler
instance mapped to "/**"
;
or null
if default servlet handling was not been enabled.@Deprecated protected AbstractHandlerMapping getHandlerMapping()
buildHandlerMapping()