Add trailing slash support to AbstractUrlHandlerMapping
Issue: SPR-12818
This commit is contained in:
@@ -110,6 +110,11 @@ public class SimpleUrlHandlerMappingTests {
|
||||
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == otherBean);
|
||||
assertEquals("welcome.x", req.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE));
|
||||
|
||||
req = new MockHttpServletRequest("GET", "/welcome/");
|
||||
hec = getHandler(hm, req);
|
||||
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == otherBean);
|
||||
assertEquals("welcome", req.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE));
|
||||
|
||||
req = new MockHttpServletRequest("GET", "/");
|
||||
req.setServletPath("/welcome.html");
|
||||
hec = getHandler(hm, req);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
|
||||
<property name="defaultHandler"><ref local="starController"/></property>
|
||||
<property name="rootHandler"><ref local="mainController"/></property>
|
||||
<property name="useTrailingSlashMatch" value="true"/>
|
||||
<property name="urlMap">
|
||||
<map>
|
||||
<entry key="/welcome*"><ref local="otherController"/></entry>
|
||||
@@ -22,6 +23,7 @@
|
||||
<bean id="urlMappingWithProps" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
|
||||
<property name="defaultHandler"><ref local="starController"/></property>
|
||||
<property name="rootHandler"><ref local="mainController"/></property>
|
||||
<property name="useTrailingSlashMatch" value="true"/>
|
||||
<property name="mappings"><ref local="propsForUrlMapping2"/></property>
|
||||
</bean>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user