Working on SPR-5631 - Implicit /** mapping on type-level @RequestMapping
This commit is contained in:
parent
4fb901c657
commit
6121da988b
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright 2002-2009 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.web.servlet.mvc.annotation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -8,8 +24,8 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
|
|
@ -73,7 +89,6 @@ public class UriTemplateServletAnnotationControllerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("In progress")
|
||||
public void relative() throws Exception {
|
||||
initServlet(RelativePathUriTemplateController.class);
|
||||
|
||||
|
|
@ -120,7 +135,6 @@ public class UriTemplateServletAnnotationControllerTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore("In progress")
|
||||
public void implicitSubPath() throws Exception {
|
||||
initServlet(ImplicitSubPathController.class);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue