Skip to content

Commit

Permalink
Mention PathPattern in functional router Javadoc
Browse files Browse the repository at this point in the history
This commit makes the various supported patterns
more discoverable.

Closes gh-32045
  • Loading branch information
sdeleuze committed Jan 17, 2024
1 parent 0ada78a commit 5dd48fc
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static RequestPredicate methods(HttpMethod... httpMethods) {
* against the given path pattern.
* @param pattern the pattern to match to
* @return a predicate that tests against the given path pattern
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate path(String pattern) {
Assert.notNull(pattern, "'pattern' must not be null");
Expand Down Expand Up @@ -169,6 +170,7 @@ public static RequestPredicate accept(MediaType... mediaTypes) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is GET and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate GET(String pattern) {
return method(HttpMethod.GET).and(path(pattern));
Expand All @@ -180,6 +182,7 @@ public static RequestPredicate GET(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is HEAD and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate HEAD(String pattern) {
return method(HttpMethod.HEAD).and(path(pattern));
Expand All @@ -191,6 +194,7 @@ public static RequestPredicate HEAD(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is POST and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate POST(String pattern) {
return method(HttpMethod.POST).and(path(pattern));
Expand All @@ -202,6 +206,7 @@ public static RequestPredicate POST(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PUT and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate PUT(String pattern) {
return method(HttpMethod.PUT).and(path(pattern));
Expand All @@ -213,6 +218,7 @@ public static RequestPredicate PUT(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PATCH and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate PATCH(String pattern) {
return method(HttpMethod.PATCH).and(path(pattern));
Expand All @@ -224,6 +230,7 @@ public static RequestPredicate PATCH(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is DELETE and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate DELETE(String pattern) {
return method(HttpMethod.DELETE).and(path(pattern));
Expand All @@ -235,6 +242,7 @@ public static RequestPredicate DELETE(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is OPTIONS and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate OPTIONS(String pattern) {
return method(HttpMethod.OPTIONS).and(path(pattern));
Expand Down Expand Up @@ -342,6 +350,7 @@ public interface Visitor {
* Receive notification of a path predicate.
* @param pattern the path pattern that makes up the predicate
* @see RequestPredicates#path(String)
* @see org.springframework.web.util.pattern.PathPattern
*/
void path(String pattern);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public static <T extends ServerResponse> RouterFunction<T> nest(
* @param pattern the pattern to match
* @param location the location directory relative to which resources should be resolved
* @return a router function that routes to resources
* @see org.springframework.web.util.pattern.PathPattern
* @see #resourceLookupFunction(String, Resource)
*/
public static RouterFunction<ServerResponse> resources(String pattern, Resource location) {
Expand All @@ -173,6 +174,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
* @param headersConsumer provides access to the HTTP headers for served resources
* @return a router function that routes to resources
* @since 6.1
* @see org.springframework.web.util.pattern.PathPattern
* @see #resourceLookupFunction(String, Resource)
*/
public static RouterFunction<ServerResponse> resources(String pattern, Resource location,
Expand All @@ -194,6 +196,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
* @param pattern the pattern to match
* @param location the location directory relative to which resources should be resolved
* @return the default resource lookup function for the given parameters.
* @see org.springframework.web.util.pattern.PathPattern
*/
public static Function<ServerRequest, Mono<Resource>> resourceLookupFunction(String pattern, Resource location) {
return new PathResourceLookupFunction(pattern, location);
Expand Down Expand Up @@ -338,6 +341,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code GET} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder GET(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand Down Expand Up @@ -369,6 +373,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code GET} requests that
* match {@code pattern} and the predicate
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
* @see RequestPredicates
*/
Builder GET(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
Expand All @@ -388,6 +393,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code HEAD} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder HEAD(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -411,6 +417,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code HEAD} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder HEAD(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -429,6 +436,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code POST} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder POST(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand Down Expand Up @@ -460,6 +468,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code POST} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder POST(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -478,6 +487,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code PUT} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder PUT(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand Down Expand Up @@ -509,6 +519,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code PUT} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder PUT(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -527,6 +538,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code PATCH} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder PATCH(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand Down Expand Up @@ -558,6 +570,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code PATCH} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder PATCH(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -576,6 +589,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code DELETE} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder DELETE(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -599,6 +613,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code DELETE} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder DELETE(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -617,6 +632,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code OPTIONS} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder OPTIONS(String pattern, HandlerFunction<ServerResponse> handlerFunction);

Expand All @@ -640,6 +656,7 @@ public interface Builder {
* @param handlerFunction the handler function to handle all {@code OPTIONS} requests that
* match {@code pattern}
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder OPTIONS(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);

Expand Down Expand Up @@ -685,6 +702,7 @@ public interface Builder {
* @param pattern the pattern to match
* @param location the location directory relative to which resources should be resolved
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder resources(String pattern, Resource location);

Expand All @@ -700,6 +718,7 @@ public interface Builder {
* @param headersConsumer provides access to the HTTP headers for served resources
* @return this builder
* @since 6.1
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder resources(String pattern, Resource location, BiConsumer<Resource, HttpHeaders> headersConsumer);

Expand Down Expand Up @@ -790,6 +809,7 @@ public interface Builder {
* @param routerFunctionSupplier supplier for the nested router function to delegate to if
* the pattern matches
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder path(String pattern, Supplier<RouterFunction<ServerResponse>> routerFunctionSupplier);

Expand All @@ -812,6 +832,7 @@ public interface Builder {
* @param builderConsumer consumer for a {@code Builder} that provides the nested router
* function
* @return this builder
* @see org.springframework.web.util.pattern.PathPattern
*/
Builder path(String pattern, Consumer<Builder> builderConsumer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static RequestPredicate methods(HttpMethod... httpMethods) {
* against the given path pattern.
* @param pattern the pattern to match to
* @return a predicate that tests against the given path pattern
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate path(String pattern) {
Assert.notNull(pattern, "'pattern' must not be null");
Expand Down Expand Up @@ -169,6 +170,7 @@ public static RequestPredicate accept(MediaType... mediaTypes) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is GET and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate GET(String pattern) {
return method(HttpMethod.GET).and(path(pattern));
Expand All @@ -180,6 +182,7 @@ public static RequestPredicate GET(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is HEAD and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate HEAD(String pattern) {
return method(HttpMethod.HEAD).and(path(pattern));
Expand All @@ -191,6 +194,7 @@ public static RequestPredicate HEAD(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is POST and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate POST(String pattern) {
return method(HttpMethod.POST).and(path(pattern));
Expand All @@ -202,6 +206,7 @@ public static RequestPredicate POST(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PUT and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate PUT(String pattern) {
return method(HttpMethod.PUT).and(path(pattern));
Expand All @@ -213,6 +218,7 @@ public static RequestPredicate PUT(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is PATCH and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate PATCH(String pattern) {
return method(HttpMethod.PATCH).and(path(pattern));
Expand All @@ -224,6 +230,7 @@ public static RequestPredicate PATCH(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is DELETE and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate DELETE(String pattern) {
return method(HttpMethod.DELETE).and(path(pattern));
Expand All @@ -235,6 +242,7 @@ public static RequestPredicate DELETE(String pattern) {
* @param pattern the path pattern to match against
* @return a predicate that matches if the request method is OPTIONS and if the given pattern
* matches against the request path
* @see org.springframework.web.util.pattern.PathPattern
*/
public static RequestPredicate OPTIONS(String pattern) {
return method(HttpMethod.OPTIONS).and(path(pattern));
Expand Down Expand Up @@ -341,6 +349,7 @@ public interface Visitor {
* Receive notification of a path predicate.
* @param pattern the path pattern that makes up the predicate
* @see RequestPredicates#path(String)
* @see org.springframework.web.util.pattern.PathPattern
*/
void path(String pattern);

Expand Down
Loading

0 comments on commit 5dd48fc

Please sign in to comment.