While investigating a UrlHandlerFilter with FORWARD scenario under #35509, I experimented with async/error dispatches, and spotted more issues.

The path is parsed and cached, or accessed if previously parsed, in order to inspect, but it remains as the cached path, but it has the trailing slash. This is mitigated by the DispatcherServlet parsing it on its own, but affects async dispatches that see it as previously parsed. For this, we should only parse, if necessary (but not cache), and then ensure the path without the trailing slash is cached at the point of wrapping and delegating to the rest of the filter chain.

There is no need to filter ERROR dispatches which is a different path (like FORWARD).

There is no need to filter the ASYNC dispatch either because that's done with the wrapped request, which reflects the modified URL without a trailing slash.