Skip to content

Commit 5dd48fc

Browse files
committed
Mention PathPattern in functional router Javadoc
This commit makes the various supported patterns more discoverable. Closes gh-32045
1 parent 0ada78a commit 5dd48fc

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java

+9
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public static RequestPredicate methods(HttpMethod... httpMethods) {
107107
* against the given path pattern.
108108
* @param pattern the pattern to match to
109109
* @return a predicate that tests against the given path pattern
110+
* @see org.springframework.web.util.pattern.PathPattern
110111
*/
111112
public static RequestPredicate path(String pattern) {
112113
Assert.notNull(pattern, "'pattern' must not be null");
@@ -169,6 +170,7 @@ public static RequestPredicate accept(MediaType... mediaTypes) {
169170
* @param pattern the path pattern to match against
170171
* @return a predicate that matches if the request method is GET and if the given pattern
171172
* matches against the request path
173+
* @see org.springframework.web.util.pattern.PathPattern
172174
*/
173175
public static RequestPredicate GET(String pattern) {
174176
return method(HttpMethod.GET).and(path(pattern));
@@ -180,6 +182,7 @@ public static RequestPredicate GET(String pattern) {
180182
* @param pattern the path pattern to match against
181183
* @return a predicate that matches if the request method is HEAD and if the given pattern
182184
* matches against the request path
185+
* @see org.springframework.web.util.pattern.PathPattern
183186
*/
184187
public static RequestPredicate HEAD(String pattern) {
185188
return method(HttpMethod.HEAD).and(path(pattern));
@@ -191,6 +194,7 @@ public static RequestPredicate HEAD(String pattern) {
191194
* @param pattern the path pattern to match against
192195
* @return a predicate that matches if the request method is POST and if the given pattern
193196
* matches against the request path
197+
* @see org.springframework.web.util.pattern.PathPattern
194198
*/
195199
public static RequestPredicate POST(String pattern) {
196200
return method(HttpMethod.POST).and(path(pattern));
@@ -202,6 +206,7 @@ public static RequestPredicate POST(String pattern) {
202206
* @param pattern the path pattern to match against
203207
* @return a predicate that matches if the request method is PUT and if the given pattern
204208
* matches against the request path
209+
* @see org.springframework.web.util.pattern.PathPattern
205210
*/
206211
public static RequestPredicate PUT(String pattern) {
207212
return method(HttpMethod.PUT).and(path(pattern));
@@ -213,6 +218,7 @@ public static RequestPredicate PUT(String pattern) {
213218
* @param pattern the path pattern to match against
214219
* @return a predicate that matches if the request method is PATCH and if the given pattern
215220
* matches against the request path
221+
* @see org.springframework.web.util.pattern.PathPattern
216222
*/
217223
public static RequestPredicate PATCH(String pattern) {
218224
return method(HttpMethod.PATCH).and(path(pattern));
@@ -224,6 +230,7 @@ public static RequestPredicate PATCH(String pattern) {
224230
* @param pattern the path pattern to match against
225231
* @return a predicate that matches if the request method is DELETE and if the given pattern
226232
* matches against the request path
233+
* @see org.springframework.web.util.pattern.PathPattern
227234
*/
228235
public static RequestPredicate DELETE(String pattern) {
229236
return method(HttpMethod.DELETE).and(path(pattern));
@@ -235,6 +242,7 @@ public static RequestPredicate DELETE(String pattern) {
235242
* @param pattern the path pattern to match against
236243
* @return a predicate that matches if the request method is OPTIONS and if the given pattern
237244
* matches against the request path
245+
* @see org.springframework.web.util.pattern.PathPattern
238246
*/
239247
public static RequestPredicate OPTIONS(String pattern) {
240248
return method(HttpMethod.OPTIONS).and(path(pattern));
@@ -342,6 +350,7 @@ public interface Visitor {
342350
* Receive notification of a path predicate.
343351
* @param pattern the path pattern that makes up the predicate
344352
* @see RequestPredicates#path(String)
353+
* @see org.springframework.web.util.pattern.PathPattern
345354
*/
346355
void path(String pattern);
347356

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RouterFunctions.java

+21
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public static <T extends ServerResponse> RouterFunction<T> nest(
155155
* @param pattern the pattern to match
156156
* @param location the location directory relative to which resources should be resolved
157157
* @return a router function that routes to resources
158+
* @see org.springframework.web.util.pattern.PathPattern
158159
* @see #resourceLookupFunction(String, Resource)
159160
*/
160161
public static RouterFunction<ServerResponse> resources(String pattern, Resource location) {
@@ -173,6 +174,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
173174
* @param headersConsumer provides access to the HTTP headers for served resources
174175
* @return a router function that routes to resources
175176
* @since 6.1
177+
* @see org.springframework.web.util.pattern.PathPattern
176178
* @see #resourceLookupFunction(String, Resource)
177179
*/
178180
public static RouterFunction<ServerResponse> resources(String pattern, Resource location,
@@ -194,6 +196,7 @@ public static RouterFunction<ServerResponse> resources(String pattern, Resource
194196
* @param pattern the pattern to match
195197
* @param location the location directory relative to which resources should be resolved
196198
* @return the default resource lookup function for the given parameters.
199+
* @see org.springframework.web.util.pattern.PathPattern
197200
*/
198201
public static Function<ServerRequest, Mono<Resource>> resourceLookupFunction(String pattern, Resource location) {
199202
return new PathResourceLookupFunction(pattern, location);
@@ -338,6 +341,7 @@ public interface Builder {
338341
* @param handlerFunction the handler function to handle all {@code GET} requests that
339342
* match {@code pattern}
340343
* @return this builder
344+
* @see org.springframework.web.util.pattern.PathPattern
341345
*/
342346
Builder GET(String pattern, HandlerFunction<ServerResponse> handlerFunction);
343347

@@ -369,6 +373,7 @@ public interface Builder {
369373
* @param handlerFunction the handler function to handle all {@code GET} requests that
370374
* match {@code pattern} and the predicate
371375
* @return this builder
376+
* @see org.springframework.web.util.pattern.PathPattern
372377
* @see RequestPredicates
373378
*/
374379
Builder GET(String pattern, RequestPredicate predicate, HandlerFunction<ServerResponse> handlerFunction);
@@ -388,6 +393,7 @@ public interface Builder {
388393
* @param handlerFunction the handler function to handle all {@code HEAD} requests that
389394
* match {@code pattern}
390395
* @return this builder
396+
* @see org.springframework.web.util.pattern.PathPattern
391397
*/
392398
Builder HEAD(String pattern, HandlerFunction<ServerResponse> handlerFunction);
393399

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

spring-webmvc/src/main/java/org/springframework/web/servlet/function/RequestPredicates.java

+9
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public static RequestPredicate methods(HttpMethod... httpMethods) {
107107
* against the given path pattern.
108108
* @param pattern the pattern to match to
109109
* @return a predicate that tests against the given path pattern
110+
* @see org.springframework.web.util.pattern.PathPattern
110111
*/
111112
public static RequestPredicate path(String pattern) {
112113
Assert.notNull(pattern, "'pattern' must not be null");
@@ -169,6 +170,7 @@ public static RequestPredicate accept(MediaType... mediaTypes) {
169170
* @param pattern the path pattern to match against
170171
* @return a predicate that matches if the request method is GET and if the given pattern
171172
* matches against the request path
173+
* @see org.springframework.web.util.pattern.PathPattern
172174
*/
173175
public static RequestPredicate GET(String pattern) {
174176
return method(HttpMethod.GET).and(path(pattern));
@@ -180,6 +182,7 @@ public static RequestPredicate GET(String pattern) {
180182
* @param pattern the path pattern to match against
181183
* @return a predicate that matches if the request method is HEAD and if the given pattern
182184
* matches against the request path
185+
* @see org.springframework.web.util.pattern.PathPattern
183186
*/
184187
public static RequestPredicate HEAD(String pattern) {
185188
return method(HttpMethod.HEAD).and(path(pattern));
@@ -191,6 +194,7 @@ public static RequestPredicate HEAD(String pattern) {
191194
* @param pattern the path pattern to match against
192195
* @return a predicate that matches if the request method is POST and if the given pattern
193196
* matches against the request path
197+
* @see org.springframework.web.util.pattern.PathPattern
194198
*/
195199
public static RequestPredicate POST(String pattern) {
196200
return method(HttpMethod.POST).and(path(pattern));
@@ -202,6 +206,7 @@ public static RequestPredicate POST(String pattern) {
202206
* @param pattern the path pattern to match against
203207
* @return a predicate that matches if the request method is PUT and if the given pattern
204208
* matches against the request path
209+
* @see org.springframework.web.util.pattern.PathPattern
205210
*/
206211
public static RequestPredicate PUT(String pattern) {
207212
return method(HttpMethod.PUT).and(path(pattern));
@@ -213,6 +218,7 @@ public static RequestPredicate PUT(String pattern) {
213218
* @param pattern the path pattern to match against
214219
* @return a predicate that matches if the request method is PATCH and if the given pattern
215220
* matches against the request path
221+
* @see org.springframework.web.util.pattern.PathPattern
216222
*/
217223
public static RequestPredicate PATCH(String pattern) {
218224
return method(HttpMethod.PATCH).and(path(pattern));
@@ -224,6 +230,7 @@ public static RequestPredicate PATCH(String pattern) {
224230
* @param pattern the path pattern to match against
225231
* @return a predicate that matches if the request method is DELETE and if the given pattern
226232
* matches against the request path
233+
* @see org.springframework.web.util.pattern.PathPattern
227234
*/
228235
public static RequestPredicate DELETE(String pattern) {
229236
return method(HttpMethod.DELETE).and(path(pattern));
@@ -235,6 +242,7 @@ public static RequestPredicate DELETE(String pattern) {
235242
* @param pattern the path pattern to match against
236243
* @return a predicate that matches if the request method is OPTIONS and if the given pattern
237244
* matches against the request path
245+
* @see org.springframework.web.util.pattern.PathPattern
238246
*/
239247
public static RequestPredicate OPTIONS(String pattern) {
240248
return method(HttpMethod.OPTIONS).and(path(pattern));
@@ -341,6 +349,7 @@ public interface Visitor {
341349
* Receive notification of a path predicate.
342350
* @param pattern the path pattern that makes up the predicate
343351
* @see RequestPredicates#path(String)
352+
* @see org.springframework.web.util.pattern.PathPattern
344353
*/
345354
void path(String pattern);
346355

0 commit comments

Comments
 (0)