@RequestParam/RequestHeader/CookieValue's defaultValue allows for declaring empty String (SPR-6791)

This commit is contained in:
Juergen Hoeller
2010-02-15 12:10:55 +00:00
parent 83231997c0
commit 97059f4e18
6 changed files with 58 additions and 16 deletions

View File

@@ -199,7 +199,7 @@ public class ServletAnnotationControllerTests {
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/myPath.do");
MockHttpServletResponse response = new MockHttpServletResponse();
servlet.service(request, response);
assertEquals("foo-null-bar", response.getContentAsString());
assertEquals("foo--bar", response.getContentAsString());
}
@Test
@@ -1970,7 +1970,7 @@ public class ServletAnnotationControllerTests {
@RequestMapping("/myPath.do")
public void myHandle(@RequestParam(value = "id", defaultValue = "foo") String id,
@RequestParam(value = "otherId", required = false) String id2,
@RequestParam(value = "otherId", defaultValue = "") String id2,
@RequestHeader(defaultValue = "bar") String header,
HttpServletResponse response) throws IOException {
response.getWriter().write(String.valueOf(id) + "-" + String.valueOf(id2) + "-" + String.valueOf(header));