|
|
|
@ -60,12 +60,15 @@ public class RequestMappingHandlerMethodMappingTests { |
|
|
|
|
|
|
|
|
|
|
|
private HandlerMethod barMethod; |
|
|
|
private HandlerMethod barMethod; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HandlerMethod emptyMethod; |
|
|
|
|
|
|
|
|
|
|
|
@Before |
|
|
|
@Before |
|
|
|
public void setUp() throws Exception { |
|
|
|
public void setUp() throws Exception { |
|
|
|
handler = new Handler(); |
|
|
|
handler = new Handler(); |
|
|
|
fooMethod = new HandlerMethod(handler, "foo"); |
|
|
|
fooMethod = new HandlerMethod(handler, "foo"); |
|
|
|
fooParamMethod = new HandlerMethod(handler, "fooParam"); |
|
|
|
fooParamMethod = new HandlerMethod(handler, "fooParam"); |
|
|
|
barMethod = new HandlerMethod(handler, "bar"); |
|
|
|
barMethod = new HandlerMethod(handler, "bar"); |
|
|
|
|
|
|
|
emptyMethod = new HandlerMethod(handler, "empty"); |
|
|
|
|
|
|
|
|
|
|
|
StaticApplicationContext context = new StaticApplicationContext(); |
|
|
|
StaticApplicationContext context = new StaticApplicationContext(); |
|
|
|
context.registerSingleton("handler", handler.getClass()); |
|
|
|
context.registerSingleton("handler", handler.getClass()); |
|
|
|
@ -88,6 +91,17 @@ public class RequestMappingHandlerMethodMappingTests { |
|
|
|
assertEquals(barMethod.getMethod(), hm.getMethod()); |
|
|
|
assertEquals(barMethod.getMethod(), hm.getMethod()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void emptyPathMatch() throws Exception { |
|
|
|
|
|
|
|
MockHttpServletRequest request = new MockHttpServletRequest("GET", ""); |
|
|
|
|
|
|
|
HandlerMethod hm = (HandlerMethod) mapping.getHandler(request).getHandler(); |
|
|
|
|
|
|
|
assertEquals(emptyMethod.getMethod(), hm.getMethod()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request = new MockHttpServletRequest("GET", "/"); |
|
|
|
|
|
|
|
hm = (HandlerMethod) mapping.getHandler(request).getHandler(); |
|
|
|
|
|
|
|
assertEquals(emptyMethod.getMethod(), hm.getMethod()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: SPR-8247
|
|
|
|
// TODO: SPR-8247
|
|
|
|
@Ignore |
|
|
|
@Ignore |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -144,6 +158,7 @@ public class RequestMappingHandlerMethodMappingTests { |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused") |
|
|
|
@SuppressWarnings("unused") |
|
|
|
@Controller |
|
|
|
@Controller |
|
|
|
|
|
|
|
@RequestMapping |
|
|
|
private static class Handler { |
|
|
|
private static class Handler { |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/foo", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/foo", method = RequestMethod.GET) |
|
|
|
@ -157,6 +172,10 @@ public class RequestMappingHandlerMethodMappingTests { |
|
|
|
@RequestMapping(value = "/ba*", method = { RequestMethod.GET, RequestMethod.HEAD }) |
|
|
|
@RequestMapping(value = "/ba*", method = { RequestMethod.GET, RequestMethod.HEAD }) |
|
|
|
public void bar() { |
|
|
|
public void bar() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "") |
|
|
|
|
|
|
|
public void empty() { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |