@Test
public void requestsWithFullPaths() throws Exception {
BeanNameUrlHandlerMapping hm = new BeanNameUrlHandlerMapping();
hm.setAlwaysUseFullPath(true);
hm.setApplicationContext(wac);
Object bean = wac.getBean("godCtrl");
MockHttpServletRequest req = new MockHttpServletRequest("GET", "/mypath/welcome.html");
HandlerExecutionChain hec = hm.getHandler(req);
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
req = new MockHttpServletRequest("GET", "/myapp/mypath/welcome.html");
req.setContextPath("/myapp");
hec = hm.getHandler(req);
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
req = new MockHttpServletRequest("GET", "/mypath/welcome.html");
req.setContextPath("");
req.setServletPath("/mypath");
hec = hm.getHandler(req);
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
req = new MockHttpServletRequest("GET", "/Myapp/mypath/welcome.html");
req.setContextPath("/myapp");
req.setServletPath("/mypath");
hec = hm.getHandler(req);
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
req = new MockHttpServletRequest("GET", "/");
hec = hm.getHandler(req);
assertTrue("Handler is correct bean", hec != null && hec.getHandler() == bean);
}