I am having trouble getting my url-mapping correct.
My Controller looks like this…
@Controller
@RequestMapping(value = "/rest/report")
public class ReportController extends CatalogManagementBaseController {
...
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody String test(Model model) throws Exception{
return "Worked!";
}
}
And my url-mapping looks like this..`
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>`
If I change the url mapping to / it works but I want the dispatcher to only handle the requests sent to ../rest/…
Any idea what I am doing wrong? Could it be something to do with the inheritance?
If you want the dispatcher to be mapped to
/rest/*then I believe you should remove this prefix from the controller’s@RequestMapping, i.e. only haveRequestMapping(/report).The mapping you have configured would result in the Controller listening to requests on
/rest/rest/report