SPR-6978 - Dispatcher fails to invoke handler method when request method conflicts with request path

This commit is contained in:
Arjen Poutsma
2010-03-22 14:12:32 +00:00
parent b07d02f1bf
commit 4c0744ee54
2 changed files with 55 additions and 1 deletions

View File

@@ -637,8 +637,11 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
Map<String, String> variables =
(Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
int patternVariableCount = StringUtils.countOccurrencesOf(mappedPattern, "{");
if (CollectionUtils.isEmpty(variables) && pathMatcher.match(mappedPattern, lookupPath)) {
if ( (variables == null || patternVariableCount != variables.size())
&& pathMatcher.match(mappedPattern, lookupPath)) {
variables = pathMatcher.extractUriTemplateVariables(mappedPattern, lookupPath);
request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, variables);
}