diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/MvcDefaultServletHandler.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/MvcDefaultServletHandler.java index 01765173a6..b14cfcfe46 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/MvcDefaultServletHandler.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/config/MvcDefaultServletHandler.java @@ -33,6 +33,13 @@ import org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler *
  • {@link HttpRequestHandlerAdapter} to enable the DispatcherServlet to be * able to invoke the above request handler. * + * + * This handler will forward all requests to the default Servlet. Therefore + * it is important that it remains last in the order of all other URL + * HandlerMappings. That will be the case if you use the {@link MvcAnnotationDriven} + * feature or alternatively if you are setting up your customized HandlerMapping + * instance be sure to set its "order" property to a value lower than that of + * the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE. * * @author Rossen Stoyanchev * @since 3.1 diff --git a/org.springframework.web.servlet/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.1.xsd b/org.springframework.web.servlet/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.1.xsd index b788c93314..0761dea919 100644 --- a/org.springframework.web.servlet/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.1.xsd +++ b/org.springframework.web.servlet/src/main/resources/org/springframework/web/servlet/config/spring-mvc-3.1.xsd @@ -171,6 +171,10 @@ Configures a handler for serving static resources by forwarding to the Servlet container's default Servlet. Use of this handler allows using a "/" mapping with the DispatcherServlet while still utilizing the Servlet container to serve static resources. + This handler will forward all requests to the default Servlet. Therefore it is important that it remains last in the + order of all other URL HandlerMappings. That will be the case if you use the "annotation-driven" element or alternatively + if you are setting up your customized HandlerMapping instance be sure to set its "order" property to a value lower than + that of the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE. ]]> diff --git a/spring-framework-reference/src/mvc.xml b/spring-framework-reference/src/mvc.xml index c9e983ce74..6611c231ba 100644 --- a/spring-framework-reference/src/mvc.xml +++ b/spring-framework-reference/src/mvc.xml @@ -3509,8 +3509,16 @@ application.version=1.0.0]]> This tag allows for mapping the DispatcherServlet to "/" (thus overriding the mapping of the container's default Servlet), while still allowing static resource requests to be handled by the container's default Servlet. It configures a - DefaultServletHttpRequestHandler with a URL mapping (given a lowest precedence order) of "/**". This handler will - forward all requests to the default Servlet. To enable this feature using the default setup, simply include the tag in the form: + DefaultServletHttpRequestHandler with a URL mapping of "/**" and the lowest priority relative to other URL mappings. + + + This handler will forward all requests to the default Servlet. Therefore it is important that it remains last in the order of all + other URL HandlerMappings. That will be the case if you use <mvc:annotation-driven> or alternatively if you + are setting up your own customized HandlerMapping instance be sure to set its order property to a value lower than + that of the DefaultServletHttpRequestHandler, which is Integer.MAX_VALUE. + + + To enable the feature using the default setup, simply include the tag in the form: ]]>