Decode path vars in pre-3.1 `@MVC` support clases too

See the commit comments for:
57307a0b2e

This commit also applies the change to pre-3.1 `@MVC` suppor classes.

Issue: SPR-6951
This commit is contained in:
Rossen Stoyanchev 2012-05-17 16:35:55 -04:00
parent 57307a0b2e
commit 0105c5ebb9
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -185,8 +185,9 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping {
Map<String, String> uriTemplateVariables = new LinkedHashMap<String, String>();
for (String matchingPattern : matchingPatterns) {
if (patternComparator.compare(bestPatternMatch, matchingPattern) == 0) {
uriTemplateVariables
.putAll(getPathMatcher().extractUriTemplateVariables(matchingPattern, urlPath));
Map<String, String> vars = getPathMatcher().extractUriTemplateVariables(matchingPattern, urlPath);
Map<String, String> decodedVars = getUrlPathHelper().decodePathVariables(request, vars);
uriTemplateVariables.putAll(decodedVars);
}
}
if (logger.isDebugEnabled()) {

View File

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