Working on SPR-5631 - Implicit /** mapping on type-level @RequestMapping

This commit is contained in:
Arjen Poutsma
2009-04-16 13:23:24 +00:00
parent 4fb901c657
commit 6121da988b
2 changed files with 29 additions and 7 deletions

View File

@@ -110,11 +110,19 @@ public class DefaultAnnotationHandlerMapping extends AbstractDetectingUrlHandler
// @RequestMapping found at type level
this.cachedMappings.put(handlerType, mapping);
Set<String> urls = new LinkedHashSet<String>();
String[] paths = mapping.value();
if (paths.length > 0) {
String[] typeLevelPaths = mapping.value();
if (typeLevelPaths.length > 0) {
// @RequestMapping specifies paths at type level
for (String path : paths) {
addUrlsForPath(urls, path);
String[] methodLevelPaths = determineUrlsForHandlerMethods(handlerType);
for (String typeLevelPath : typeLevelPaths) {
if (!typeLevelPath.startsWith("/")) {
typeLevelPath = "/" + typeLevelPath;
}
for (String methodLevelPath : methodLevelPaths) {
String combinedPath = getPathMatcher().combine(typeLevelPath, methodLevelPath);
addUrlsForPath(urls, combinedPath);
}
addUrlsForPath(urls, typeLevelPath);
}
return StringUtils.toStringArray(urls);
}