From e24e76805479a3a8ab3b4b2a73b8c272afa36baa Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Thu, 15 Oct 2009 09:18:14 +0000 Subject: [PATCH] SPR-6164 - a Uri Value is incorrectly extracted if it contains '.'. --- ...plateServletAnnotationControllerTests.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java index 5f74887b1a..d245d83e8a 100644 --- a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java +++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java @@ -235,6 +235,29 @@ public class UriTemplateServletAnnotationControllerTests { servlet.init(new MockServletConfig()); } + @Test + public void noDefaultSuffixPattern() throws Exception { + servlet = new DispatcherServlet() { + @Override + protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) + throws BeansException { + GenericWebApplicationContext wac = new GenericWebApplicationContext(); + wac.registerBeanDefinition("controller", new RootBeanDefinition(ImplicitSubPathController.class)); + RootBeanDefinition mappingDef = new RootBeanDefinition(DefaultAnnotationHandlerMapping.class); + mappingDef.getPropertyValues().addPropertyValue("useDefaultSuffixPattern", false); + wac.registerBeanDefinition("handlerMapping", mappingDef); + wac.refresh(); + return wac; + } + }; + servlet.init(new MockServletConfig()); + + MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hotels/hotel.with.dot"); + MockHttpServletResponse response = new MockHttpServletResponse(); + servlet.service(request, response); + assertEquals("test-hotel.with.dot", response.getContentAsString()); + } + /* * Controllers */ @@ -406,5 +429,4 @@ public class UriTemplateServletAnnotationControllerTests { } } - }