mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
d37ef61b30
Prior to this commit, the reactive `ResourceWebHandler` would only look at the path within the current mapping when resolving static resources to be served. This means that when registering a handler at `"/resources/**"` with a `"classpath:/static/"` location, the handler would process a `"GET /resources/file.txt"` as the `"/static/file.txt"` classpath location. When a developer registers a fixed pattern like `"/resources/file.txt"` with the same location, the path within the handler mapping is empty as there is no dynamic part in the given pattern. While the typical use case for this feature is to register multiple resources at once with a pattern, we should support a single registration like this. This commit ensures that if the matching `PathPattern` for the current request does not have a pattern syntax (i.e. no regexp, no wildcard), we can use it to match the resource directly. Otherwise, we can use the path within the handler mapping to resolve the resource as before. Closes gh-29739