Skip to content

Commit 3944214

Browse files
committed
Fix and improve docs on {*var} pattern
Closes gh-27132
1 parent d3b1c4f commit 3944214

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,10 +64,10 @@
6464
* underneath the {@code /resources/} path, including {@code /resources/image.png}
6565
* and {@code /resources/css/spring.css}</li>
6666
* <li><code>/resources/{&#42;path}</code> &mdash; matches all files
67-
* underneath the {@code /resources/} path and captures their relative path in
68-
* a variable named "path"; {@code /resources/image.png} will match with
69-
* "path" &rarr; "/image.png", and {@code /resources/css/spring.css} will match
70-
* with "path" &rarr; "/css/spring.css"</li>
67+
* underneath the {@code /resources/}, as well as {@code /resources}, and captures
68+
* their relative path in a variable named "path"; {@code /resources/image.png}
69+
* will match with "path" &rarr; "/image.png", and {@code /resources/css/spring.css}
70+
* will match with "path" &rarr; "/css/spring.css"</li>
7171
* <li><code>/resources/{filename:\\w+}.dat</code> will match {@code /resources/spring.dat}
7272
* and assign the value {@code "spring"} to the {@code filename} variable</li>
7373
* </ul>

src/docs/asciidoc/web/webflux.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ You can map requests by using glob patterns and wildcards:
14481448

14491449
| `+{*path}+`
14501450
| Matches zero or more path segments until the end of the path and captures it as a variable named "path"
1451-
| `+"/resources/{*file}"+` matches `+"/resources/images/file.png"+` and captures `+file=images/file.png+`
1451+
| `+"/resources/{*file}"+` matches `+"/resources/images/file.png"+` and captures `+file=/images/file.png+`
14521452

14531453
|===
14541454

@@ -1517,7 +1517,7 @@ information or with the `-parameters` compiler flag on Java 8.
15171517

15181518
The syntax `{*varName}` declares a URI variable that matches zero or more remaining path
15191519
segments. For example `/resources/{*path}` matches all files under `/resources/`, and the
1520-
`"path"` variable captures the complete relative path.
1520+
`"path"` variable captures the complete path under `/resources`.
15211521

15221522
The syntax `{varName:regex}` declares a URI variable with a regular expression that has the
15231523
syntax: `{varName:regex}`. For example, given a URL of `/spring-web-3.0.5.jar`, the following method

0 commit comments

Comments
 (0)