Skip to content

Commit 85f0502

Browse files
committed
Pull WebFlux getMappingPathPatterns() implementation up in the hierarchy
This commit moves the WebFlux getMappingPathPatterns() implementation from RequestMappingHandlerMapping to RequestMappingInfoHandlerMapping so that subclasses of the latter no longer need to re-implement the method. See gh-22543
1 parent dc14ea8 commit 85f0502

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMapping.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@
5050
* the mapping between a request and a handler method.
5151
*
5252
* @author Rossen Stoyanchev
53+
* @author Sam Brannen
5354
* @since 5.0
5455
*/
5556
public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMethodMapping<RequestMappingInfo> {
@@ -67,6 +68,15 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
6768
}
6869

6970

71+
/**
72+
* Get the URL path patterns associated with the supplied {@link RequestMappingInfo}.
73+
* @since 5.2
74+
*/
75+
@Override
76+
protected Set<PathPattern> getMappingPathPatterns(RequestMappingInfo info) {
77+
return info.getPatternsCondition().getPatterns();
78+
}
79+
7080
/**
7181
* Check if the given RequestMappingInfo matches the current request and
7282
* return a (potentially new) instance with conditions that match the

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.Collections;
2222
import java.util.LinkedHashMap;
2323
import java.util.Map;
24-
import java.util.Set;
2524
import java.util.function.Predicate;
2625

2726
import org.springframework.context.EmbeddedValueResolverAware;
@@ -42,7 +41,6 @@
4241
import org.springframework.web.reactive.result.condition.RequestCondition;
4342
import org.springframework.web.reactive.result.method.RequestMappingInfo;
4443
import org.springframework.web.reactive.result.method.RequestMappingInfoHandlerMapping;
45-
import org.springframework.web.util.pattern.PathPattern;
4644

4745
/**
4846
* An extension of {@link RequestMappingInfoHandlerMapping} that creates
@@ -164,15 +162,6 @@ protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handler
164162
return info;
165163
}
166164

167-
/**
168-
* Get the URL path patterns associated with the supplied {@link RequestMappingInfo}.
169-
* @since 5.2
170-
*/
171-
@Override
172-
protected Set<PathPattern> getMappingPathPatterns(RequestMappingInfo info) {
173-
return info.getPatternsCondition().getPatterns();
174-
}
175-
176165
/**
177166
* Delegates to {@link #createRequestMappingInfo(RequestMapping, RequestCondition)},
178167
* supplying the appropriate custom {@link RequestCondition} depending on whether

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,6 @@ protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handler
477477
return null;
478478
}
479479
}
480-
481-
@Override
482-
protected Set<PathPattern> getMappingPathPatterns(RequestMappingInfo info) {
483-
return info.getPatternsCondition().getPatterns();
484-
}
485480
}
486481

487482
}

0 commit comments

Comments
 (0)