Reputation: 23477
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?
Upvotes: 1
Views: 165
Reputation: 597016
If your servlet is mapped to /rest/*
then the controller should be annotated with:
@RequestMapping(value = "/report")
Upvotes: 3
Reputation: 139921
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 have RequestMapping(/report)
.
The mapping you have configured would result in the Controller listening to requests on /rest/rest/report
Upvotes: 3