-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Currently, when parsed patterns are configured for use, we create a RequestPath
by parsing the requestURI
without having to decode it first which avoids issues with encoded reserved characters. For pathWithinApplication()
we take into account the contextPath
but not the servletPath
. It is a challenge to work with the servletPath
because it is decoded and somewhat normalized and that makes it difficult to use to do a sub-string match against the requestURI
in order to determine the remaining path.
This is okay for the needs of the default Servlet mapping "/"
which is the most common way to configure the DispatcherServlet but in some cases there is a need to run two Servlets side by side.
The goal of this issue is to add support for allow the DispatcherServlet to be mapped by prefix, so it can run side by side with another Servlet, and still be able to enable use of parsed patterns. We can do this by checking that the HttpServletMapping
is MappingMatch.PATH
(Servlet 4.0+), re-encoding the servletPath in order to make it comparable to the requestURI
, and then exposing a RequestPath
that omits contextPath
and the servletPath
from the pathWithinApplication()
.