Only respect RequestMappingInfos that have a pattern match in handleNoMatch
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4312 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
7b6c98ac9b
commit
4cebd2ef0b
|
|
@ -193,6 +193,8 @@ public class RequestMappingHandlerMapping extends AbstractHandlerMethodMapping<R
|
||||||
Set<MediaType> consumableMediaTypes = new HashSet<MediaType>();
|
Set<MediaType> consumableMediaTypes = new HashSet<MediaType>();
|
||||||
Set<MediaType> producibleMediaTypes = new HashSet<MediaType>();
|
Set<MediaType> producibleMediaTypes = new HashSet<MediaType>();
|
||||||
for (RequestMappingInfo info : requestMappingInfos) {
|
for (RequestMappingInfo info : requestMappingInfos) {
|
||||||
|
for (String pattern : info.getPatterns()) {
|
||||||
|
if (pathMatcher.match(pattern, lookupPath)) {
|
||||||
if (!info.getMethods().match(request)) {
|
if (!info.getMethods().match(request)) {
|
||||||
for (RequestMethod method : info.getMethods().getMethods()) {
|
for (RequestMethod method : info.getMethods().getMethods()) {
|
||||||
allowedMethods.add(method.name());
|
allowedMethods.add(method.name());
|
||||||
|
|
@ -205,6 +207,8 @@ public class RequestMappingHandlerMapping extends AbstractHandlerMethodMapping<R
|
||||||
producibleMediaTypes.addAll(info.getProduces().getMediaTypes());
|
producibleMediaTypes.addAll(info.getProduces().getMediaTypes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!allowedMethods.isEmpty()) {
|
if (!allowedMethods.isEmpty()) {
|
||||||
throw new HttpRequestMethodNotSupportedException(request.getMethod(), allowedMethods);
|
throw new HttpRequestMethodNotSupportedException(request.getMethod(), allowedMethods);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue