|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2019 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. |
|
|
@ -40,16 +40,16 @@ import org.springframework.util.StringUtils; |
|
|
|
* <li>{@code ?} matches one character</li> |
|
|
|
* <li>{@code ?} matches one character</li> |
|
|
|
* <li>{@code *} matches zero or more characters within a path segment</li> |
|
|
|
* <li>{@code *} matches zero or more characters within a path segment</li> |
|
|
|
* <li>{@code **} matches zero or more <em>path segments</em> until the end of the path</li> |
|
|
|
* <li>{@code **} matches zero or more <em>path segments</em> until the end of the path</li> |
|
|
|
* <li>{@code {spring}} matches a <em>path segment</em> and captures it as a variable named "spring"</li> |
|
|
|
* <li><code>{spring}</code> matches a <em>path segment</em> and captures it as a variable named "spring"</li> |
|
|
|
* <li>{@code {spring:[a-z]+}} matches the regexp {@code [a-z]+} as a path variable named "spring"</li> |
|
|
|
* <li><code>{spring:[a-z]+}</code> matches the regexp {@code [a-z]+} as a path variable named "spring"</li> |
|
|
|
* <li>{@code {*spring}} matches zero or more <em>path segments</em> until the end of the path |
|
|
|
* <li><code>{*spring}</code> matches zero or more <em>path segments</em> until the end of the path |
|
|
|
* and captures it as a variable named "spring"</li> |
|
|
|
* and captures it as a variable named "spring"</li> |
|
|
|
* </ul> |
|
|
|
* </ul> |
|
|
|
* |
|
|
|
* |
|
|
|
* <h3>Examples</h3> |
|
|
|
* <h3>Examples</h3> |
|
|
|
* <ul> |
|
|
|
* <ul> |
|
|
|
* <li>{@code /pages/t?st.html} — matches {@code /pages/test.html} but also |
|
|
|
* <li>{@code /pages/t?st.html} — matches {@code /pages/test.html} as well as |
|
|
|
* {@code /pages/tast.html} but not {@code /pages/toast.html}</li> |
|
|
|
* {@code /pages/tXst.html} but not {@code /pages/toast.html}</li> |
|
|
|
* <li>{@code /resources/*.png} — matches all {@code .png} files in the |
|
|
|
* <li>{@code /resources/*.png} — matches all {@code .png} files in the |
|
|
|
* {@code resources} directory</li> |
|
|
|
* {@code resources} directory</li> |
|
|
|
* <li><code>/resources/**</code> — matches all files |
|
|
|
* <li><code>/resources/**</code> — matches all files |
|
|
@ -58,9 +58,9 @@ import org.springframework.util.StringUtils; |
|
|
|
* <li><code>/resources/{*path}</code> — matches all files |
|
|
|
* <li><code>/resources/{*path}</code> — matches all files |
|
|
|
* underneath the {@code /resources/} path and captures their relative path in |
|
|
|
* underneath the {@code /resources/} path and captures their relative path in |
|
|
|
* a variable named "path"; {@code /resources/image.png} will match with |
|
|
|
* a variable named "path"; {@code /resources/image.png} will match with |
|
|
|
* "spring" -> "/image.png", and {@code /resources/css/spring.css} will match |
|
|
|
* "spring" → "/image.png", and {@code /resources/css/spring.css} will match |
|
|
|
* with "spring" -> "/css/spring.css"</li> |
|
|
|
* with "spring" → "/css/spring.css"</li> |
|
|
|
* <li>{@code /resources/{filename:\\w+}.dat} 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> |
|
|
|
* |
|
|
|
* |
|
|
@ -260,10 +260,10 @@ public class PathPattern implements Comparable<PathPattern> { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Determine the pattern-mapped part for the given path. |
|
|
|
* Determine the pattern-mapped part for the given path. |
|
|
|
* <p>For example: <ul> |
|
|
|
* <p>For example: <ul> |
|
|
|
* <li>'{@code /docs/cvs/commit.html}' and '{@code /docs/cvs/commit.html} -> ''</li> |
|
|
|
* <li>'{@code /docs/cvs/commit.html}' and '{@code /docs/cvs/commit.html} → ''</li> |
|
|
|
* <li>'{@code /docs/*}' and '{@code /docs/cvs/commit}' -> '{@code cvs/commit}'</li> |
|
|
|
* <li>'{@code /docs/*}' and '{@code /docs/cvs/commit}' → '{@code cvs/commit}'</li> |
|
|
|
* <li>'{@code /docs/cvs/*.html}' and '{@code /docs/cvs/commit.html} -> '{@code commit.html}'</li> |
|
|
|
* <li>'{@code /docs/cvs/*.html}' and '{@code /docs/cvs/commit.html} → '{@code commit.html}'</li> |
|
|
|
* <li>'{@code /docs/**}' and '{@code /docs/cvs/commit} -> '{@code cvs/commit}'</li> |
|
|
|
* <li>'{@code /docs/**}' and '{@code /docs/cvs/commit} → '{@code cvs/commit}'</li> |
|
|
|
* </ul> |
|
|
|
* </ul> |
|
|
|
* <p><b>Notes:</b> |
|
|
|
* <p><b>Notes:</b> |
|
|
|
* <ul> |
|
|
|
* <ul> |
|
|
|