|
|
|
@ -246,7 +246,11 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe |
|
|
|
protected HandlerMethod handleNoMatch( |
|
|
|
protected HandlerMethod handleNoMatch( |
|
|
|
Set<RequestMappingInfo> infos, String lookupPath, HttpServletRequest request) throws ServletException { |
|
|
|
Set<RequestMappingInfo> infos, String lookupPath, HttpServletRequest request) throws ServletException { |
|
|
|
|
|
|
|
|
|
|
|
PartialMatchHelper helper = PartialMatchHelper.from(infos, request); |
|
|
|
if (CollectionUtils.isEmpty(infos)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PartialMatchHelper helper = new PartialMatchHelper(infos, request); |
|
|
|
if (helper.isEmpty()) { |
|
|
|
if (helper.isEmpty()) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -295,11 +299,9 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static final class PartialMatchHelper { |
|
|
|
private static final class PartialMatchHelper { |
|
|
|
|
|
|
|
|
|
|
|
private static final PartialMatchHelper EMPTY_HELPER = new PartialMatchHelper(Collections.emptySet(), null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final List<PartialMatch> partialMatches = new ArrayList<>(); |
|
|
|
private final List<PartialMatch> partialMatches = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
private PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) { |
|
|
|
PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) { |
|
|
|
for (RequestMappingInfo info : infos) { |
|
|
|
for (RequestMappingInfo info : infos) { |
|
|
|
if (info.getActivePatternsCondition().getMatchingCondition(request) != null) { |
|
|
|
if (info.getActivePatternsCondition().getMatchingCondition(request) != null) { |
|
|
|
this.partialMatches.add(new PartialMatch(info, request)); |
|
|
|
this.partialMatches.add(new PartialMatch(info, request)); |
|
|
|
@ -307,13 +309,6 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static PartialMatchHelper from(Set<RequestMappingInfo> infos, HttpServletRequest request) { |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(infos)) { |
|
|
|
|
|
|
|
return EMPTY_HELPER; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new PartialMatchHelper(infos, request); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Whether there are any partial matches. |
|
|
|
* Whether there are any partial matches. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|