Mention AntPathMatcher regexp support
This commit documents the regexp support in `AntPathMatcher` when matching for URL patterns. This support is also mentioned in places where developers can register patterns for ViewControllers or resource handlers. Issue: SPR-14652
This commit is contained in:
parent
0681519255
commit
a8ba065a6e
|
@ -35,6 +35,7 @@ import java.util.regex.Pattern;
|
||||||
* <li>{@code ?} matches one character</li>
|
* <li>{@code ?} matches one character</li>
|
||||||
* <li>{@code *} matches zero or more characters</li>
|
* <li>{@code *} matches zero or more characters</li>
|
||||||
* <li>{@code **} matches zero or more <em>directories</em> in a path</li>
|
* <li>{@code **} matches zero or more <em>directories</em> in a path</li>
|
||||||
|
* <li>{@code {spring:[a-z]+}} matches the regexp {@code [a-z]+} as a path variable named "spring"</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <h3>Examples</h3>
|
* <h3>Examples</h3>
|
||||||
|
@ -50,6 +51,8 @@ import java.util.regex.Pattern;
|
||||||
* <li><code>org/**/servlet/bla.jsp</code> — matches
|
* <li><code>org/**/servlet/bla.jsp</code> — matches
|
||||||
* {@code org/springframework/servlet/bla.jsp} but also
|
* {@code org/springframework/servlet/bla.jsp} but also
|
||||||
* {@code org/springframework/testing/servlet/bla.jsp} and {@code org/servlet/bla.jsp}</li>
|
* {@code org/springframework/testing/servlet/bla.jsp} and {@code org/servlet/bla.jsp}</li>
|
||||||
|
* <li>{@code com/{filename:\\w+}.jsp} will match {@code com/test.jsp} and assign the value {@code test}
|
||||||
|
* to the {@code filename} variable</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p><strong>Note:</strong> a pattern and a path must both be absolute or must
|
* <p><strong>Note:</strong> a pattern and a path must both be absolute or must
|
||||||
|
|
|
@ -92,6 +92,9 @@ public class ResourceHandlerRegistry {
|
||||||
* Add a resource handler for serving static resources based on the specified URL path
|
* Add a resource handler for serving static resources based on the specified URL path
|
||||||
* patterns. The handler will be invoked for every incoming request that matches to
|
* patterns. The handler will be invoked for every incoming request that matches to
|
||||||
* one of the specified path patterns.
|
* one of the specified path patterns.
|
||||||
|
* <p>Patterns like {@code "/static/**"} or {@code "/css/{filename:\\w+\\.css}"}
|
||||||
|
* are allowed. See {@link org.springframework.util.AntPathMatcher} for more details on the
|
||||||
|
* syntax.
|
||||||
* @return A {@link ResourceHandlerRegistration} to use to further configure the
|
* @return A {@link ResourceHandlerRegistration} to use to further configure the
|
||||||
* registered resource handler
|
* registered resource handler
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,6 +49,9 @@ public class ViewControllerRegistry {
|
||||||
/**
|
/**
|
||||||
* Map a view controller to the given URL path (or pattern) in order to render
|
* Map a view controller to the given URL path (or pattern) in order to render
|
||||||
* a response with a pre-configured status code and view.
|
* a response with a pre-configured status code and view.
|
||||||
|
* <p>Patterns like {@code "/admin/**"} or {@code "/articles/{articlename:\\w+}"}
|
||||||
|
* are allowed. See {@link org.springframework.util.AntPathMatcher} for more details on the
|
||||||
|
* syntax.
|
||||||
*/
|
*/
|
||||||
public ViewControllerRegistration addViewController(String urlPath) {
|
public ViewControllerRegistration addViewController(String urlPath) {
|
||||||
ViewControllerRegistration registration = new ViewControllerRegistration(urlPath);
|
ViewControllerRegistration registration = new ViewControllerRegistration(urlPath);
|
||||||
|
|
Loading…
Reference in New Issue