You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ForwardRequestPostProcessor uses the forwarded URL only to set the servletPath of the mock request, which means requestUri and servletPath are out of sync.
This hasn't been reported as an issue since UrlPathHelper falls back on the servletPath if it doesn't match the requestURI but that's not really correct behavior, and causes issues in more modern setups like parsed patterns where we rely mainly on the requestURI and only check the servletPath if a Servlet prefix mapping can be confirmed with Servlet 4.0.
In the absence of a Servlet container, i.e. with mock request and response, there is actually no good way to take a forwardedUrl and break it down into contextPath, servletPath, and pathInfo. At best, we can assert that the forwarded URL does start with the same contextPath, but otherwise break it down into contextPath + servletPath.
Currently
ForwardRequestPostProcessor
uses the forwarded URL only to set the servletPath of the mock request, which meansrequestUri
andservletPath
are out of sync.This hasn't been reported as an issue since
UrlPathHelper
falls back on theservletPath
if it doesn't match therequestURI
but that's not really correct behavior, and causes issues in more modern setups like parsed patterns where we rely mainly on therequestURI
and only check theservletPath
if a Servlet prefix mapping can be confirmed with Servlet 4.0.In the absence of a Servlet container, i.e. with mock request and response, there is actually no good way to take a
forwardedUrl
and break it down intocontextPath
,servletPath
, andpathInfo
. At best, we can assert that the forwarded URL does start with the samecontextPath
, but otherwise break it down intocontextPath
+servletPath
.This was uncovered while working on #28607.
The text was updated successfully, but these errors were encountered: