提交 39442143 编写于 作者: R Rossen Stoyanchev

Fix and improve docs on {*var} pattern

Closes gh-27132
上级 d3b1c4f6
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -64,10 +64,10 @@ import org.springframework.util.StringUtils; ...@@ -64,10 +64,10 @@ import org.springframework.util.StringUtils;
* underneath the {@code /resources/} path, including {@code /resources/image.png} * underneath the {@code /resources/} path, including {@code /resources/image.png}
* and {@code /resources/css/spring.css}</li> * and {@code /resources/css/spring.css}</li>
* <li><code>/resources/{&#42;path}</code> &mdash; matches all files * <li><code>/resources/{&#42;path}</code> &mdash; matches all files
* underneath the {@code /resources/} path and captures their relative path in * underneath the {@code /resources/}, as well as {@code /resources}, and captures
* a variable named "path"; {@code /resources/image.png} will match with * their relative path in a variable named "path"; {@code /resources/image.png}
* "path" &rarr; "/image.png", and {@code /resources/css/spring.css} will match * will match with "path" &rarr; "/image.png", and {@code /resources/css/spring.css}
* with "path" &rarr; "/css/spring.css"</li> * will match with "path" &rarr; "/css/spring.css"</li>
* <li><code>/resources/{filename:\\w+}.dat</code> will match {@code /resources/spring.dat} * <li><code>/resources/{filename:\\w+}.dat</code> will match {@code /resources/spring.dat}
* and assign the value {@code "spring"} to the {@code filename} variable</li> * and assign the value {@code "spring"} to the {@code filename} variable</li>
* </ul> * </ul>
......
...@@ -1448,7 +1448,7 @@ You can map requests by using glob patterns and wildcards: ...@@ -1448,7 +1448,7 @@ You can map requests by using glob patterns and wildcards:
| `+{*path}+` | `+{*path}+`
| Matches zero or more path segments until the end of the path and captures it as a variable named "path" | Matches zero or more path segments until the end of the path and captures it as a variable named "path"
| `+"/resources/{*file}"+` matches `+"/resources/images/file.png"+` and captures `+file=images/file.png+` | `+"/resources/{*file}"+` matches `+"/resources/images/file.png"+` and captures `+file=/images/file.png+`
|=== |===
...@@ -1517,7 +1517,7 @@ information or with the `-parameters` compiler flag on Java 8. ...@@ -1517,7 +1517,7 @@ information or with the `-parameters` compiler flag on Java 8.
The syntax `{*varName}` declares a URI variable that matches zero or more remaining path The syntax `{*varName}` declares a URI variable that matches zero or more remaining path
segments. For example `/resources/{*path}` matches all files under `/resources/`, and the segments. For example `/resources/{*path}` matches all files under `/resources/`, and the
`"path"` variable captures the complete relative path. `"path"` variable captures the complete path under `/resources`.
The syntax `{varName:regex}` declares a URI variable with a regular expression that has the The syntax `{varName:regex}` declares a URI variable with a regular expression that has the
syntax: `{varName:regex}`. For example, given a URL of `/spring-web-3.0.5.jar`, the following method syntax: `{varName:regex}`. For example, given a URL of `/spring-web-3.0.5.jar`, the following method
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册