Browse Source

SPR-6164 - a Uri Value is incorrectly extracted if it contains '.'.

pull/23217/head
Arjen Poutsma 15 years ago
parent
commit
e24e768054
  1. 24
      org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java

24
org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/UriTemplateServletAnnotationControllerTests.java

@ -235,6 +235,29 @@ public class UriTemplateServletAnnotationControllerTests { @@ -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 { @@ -406,5 +429,4 @@ public class UriTemplateServletAnnotationControllerTests {
}
}
}

Loading…
Cancel
Save