-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
While working on spring-projects/spring-framework#25100 to optimize what UrlPathHelper
does based on Servlet 4.0 runtime knowledge of the Servlet mapping type I realized that Spring Boot which I believe is aware of the DispatcherServlet mapping pattern, could use that knowledge to configure UrlPathHelper
with alwaysUseFullPath=true
.
This can be done if the Servlet mapping is "/"
, or "/*"
which avoids unnecessary overhead to determine the servletPath as described in the referenced issue, essentially the same benefit that Servlet 4.0 HttpServletMapping brings but based on Boot's knowledge of the Servlet mapping instead. The only Servlet mapping type for which the servletPath must be determined is where there is a path prefix, e.g. "/myServlet/*"
which is less common.
Keep in mind that HttpServletMapping
is not supported everywhere, notably Jetty 9.x does not have Servlet 4.0 support, so this change should bring extra mileage there.