I need to add Restful URL in existing spring based web service.
Each URL is well mapped but after clicking Restful URL such as http://localhost:9090/Mercury/rest/invoice, all contextroot path is changed as http://localhost:9090/Mercury/rest
The point is that I want to use both restful(/rest) and *.do URL pattern
How can I set contextroot path up without /rest ?
web.xml
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Controller
@Controller
@RequestMapping("/rest")
public class InvoiceController {
@RequestMapping(value="/{name}", method=RequestMethod.GET)
public String getInvoice(@PathVariable String name, Model model) {
model.addAttribute("name", name);
return "rest.body";
}