|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* Copyright 2002-2024 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. |
|
|
|
@ -106,6 +106,7 @@ public abstract class RequestPredicates { |
|
|
|
* against the given path pattern. |
|
|
|
* against the given path pattern. |
|
|
|
* @param pattern the pattern to match to |
|
|
|
* @param pattern the pattern to match to |
|
|
|
* @return a predicate that tests against the given path pattern |
|
|
|
* @return a predicate that tests against the given path pattern |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate path(String pattern) { |
|
|
|
public static RequestPredicate path(String pattern) { |
|
|
|
Assert.notNull(pattern, "'pattern' must not be null"); |
|
|
|
Assert.notNull(pattern, "'pattern' must not be null"); |
|
|
|
@ -168,6 +169,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is GET and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is GET and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate GET(String pattern) { |
|
|
|
public static RequestPredicate GET(String pattern) { |
|
|
|
return method(HttpMethod.GET).and(path(pattern)); |
|
|
|
return method(HttpMethod.GET).and(path(pattern)); |
|
|
|
@ -179,6 +181,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is HEAD and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is HEAD and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate HEAD(String pattern) { |
|
|
|
public static RequestPredicate HEAD(String pattern) { |
|
|
|
return method(HttpMethod.HEAD).and(path(pattern)); |
|
|
|
return method(HttpMethod.HEAD).and(path(pattern)); |
|
|
|
@ -190,6 +193,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is POST and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is POST and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate POST(String pattern) { |
|
|
|
public static RequestPredicate POST(String pattern) { |
|
|
|
return method(HttpMethod.POST).and(path(pattern)); |
|
|
|
return method(HttpMethod.POST).and(path(pattern)); |
|
|
|
@ -201,6 +205,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is PUT and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is PUT and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate PUT(String pattern) { |
|
|
|
public static RequestPredicate PUT(String pattern) { |
|
|
|
return method(HttpMethod.PUT).and(path(pattern)); |
|
|
|
return method(HttpMethod.PUT).and(path(pattern)); |
|
|
|
@ -212,6 +217,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is PATCH and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is PATCH and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate PATCH(String pattern) { |
|
|
|
public static RequestPredicate PATCH(String pattern) { |
|
|
|
return method(HttpMethod.PATCH).and(path(pattern)); |
|
|
|
return method(HttpMethod.PATCH).and(path(pattern)); |
|
|
|
@ -223,6 +229,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is DELETE and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is DELETE and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate DELETE(String pattern) { |
|
|
|
public static RequestPredicate DELETE(String pattern) { |
|
|
|
return method(HttpMethod.DELETE).and(path(pattern)); |
|
|
|
return method(HttpMethod.DELETE).and(path(pattern)); |
|
|
|
@ -234,6 +241,7 @@ public abstract class RequestPredicates { |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @param pattern the path pattern to match against |
|
|
|
* @return a predicate that matches if the request method is OPTIONS and if the given pattern |
|
|
|
* @return a predicate that matches if the request method is OPTIONS and if the given pattern |
|
|
|
* matches against the request path |
|
|
|
* matches against the request path |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static RequestPredicate OPTIONS(String pattern) { |
|
|
|
public static RequestPredicate OPTIONS(String pattern) { |
|
|
|
return method(HttpMethod.OPTIONS).and(path(pattern)); |
|
|
|
return method(HttpMethod.OPTIONS).and(path(pattern)); |
|
|
|
@ -317,7 +325,6 @@ public abstract class RequestPredicates { |
|
|
|
else { |
|
|
|
else { |
|
|
|
return newPattern; |
|
|
|
return newPattern; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -337,6 +344,7 @@ public abstract class RequestPredicates { |
|
|
|
* Receive notification of a path predicate. |
|
|
|
* Receive notification of a path predicate. |
|
|
|
* @param pattern the path pattern that makes up the predicate |
|
|
|
* @param pattern the path pattern that makes up the predicate |
|
|
|
* @see RequestPredicates#path(String) |
|
|
|
* @see RequestPredicates#path(String) |
|
|
|
|
|
|
|
* @see org.springframework.web.util.pattern.PathPattern |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void path(String pattern); |
|
|
|
void path(String pattern); |
|
|
|
|
|
|
|
|
|
|
|
|