mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 14:09:25 +00:00
Update docs on trailing slash handling
Closes gh-36198
This commit is contained in:
@@ -100,10 +100,18 @@ public final class UrlHandlerFilter extends OncePerRequestFilter {
|
||||
|
||||
|
||||
/**
|
||||
* Create a builder by adding a handler for URL's with a trailing slash.
|
||||
* @param pathPatterns path patterns to map the handler to, for example,
|
||||
* <code>"/path/*"</code>, <code>"/path/**"</code>,
|
||||
* <code>"/path/foo/"</code>.
|
||||
* Add a handler that removes the trailing slash from URL paths to ensure
|
||||
* consistent interpretation of paths with or without a trailing slash for
|
||||
* requestion mapping purposes. This is important especially to avoid
|
||||
* misalignment between URL-based authorization decisions and web framework
|
||||
* request mappings.
|
||||
* <p>The root path {@code "/"} is excluded from trailing slash handling.
|
||||
* <p><strong>Note:</strong> A method-level {@code @RequestMapping("/")} adds
|
||||
* a trailing slash to a type-level prefix mapping, and therefore would never
|
||||
* match to a URL with the trailing slash removed. Use {@code @RequestMapping}
|
||||
* without a path instead to avoid the trailing slash in the mapping.
|
||||
* @param pathPatterns patterns to map the handler to, e.g.
|
||||
* <code>"/path/*"</code>, <code>"/path/**"</code>, <code>"/path/foo/"</code>
|
||||
* @return a spec to configure the trailing slash handler with
|
||||
* @see Builder#trailingSlashHandler(String...)
|
||||
*/
|
||||
|
||||
+12
-4
@@ -91,10 +91,18 @@ public final class UrlHandlerFilter implements WebFilter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a builder by adding a handler for URL's with a trailing slash.
|
||||
* @param pathPatterns path patterns to map the handler to, e.g.
|
||||
* <code>"/path/*"</code>, <code>"/path/**"</code>,
|
||||
* <code>"/path/foo/"</code>.
|
||||
* Add a handler that removes the trailing slash from URL paths to ensure
|
||||
* consistent interpretation of paths with or without a trailing slash for
|
||||
* requestion mapping purposes. This is important especially to avoid
|
||||
* misalignment between URL-based authorization decisions and web framework
|
||||
* request mappings.
|
||||
* <p>The root path {@code "/"} is excluded from trailing slash handling.
|
||||
* <p><strong>Note:</strong> A method-level {@code @RequestMapping("/")} adds
|
||||
* a trailing slash to a type-level prefix mapping, and therefore would never
|
||||
* match to a URL with the trailing slash removed. Use {@code @RequestMapping}
|
||||
* without a path instead to avoid the trailing slash in the mapping.
|
||||
* @param pathPatterns patterns to map the handler to, e.g.
|
||||
* <code>"/path/*"</code>, <code>"/path/**"</code>, <code>"/path/foo/"</code>
|
||||
* @return a spec to configure the trailing slash handler with
|
||||
* @see Builder#trailingSlashHandler(String...)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user