I have a problem: initially I had this servlet-mapping:
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
and all was pretty fine with controllers mapped to example.html, example2.html urls. But in some cases I want to use *.json mapping and for this case I changed servlet mapping by this way:
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
After this change I got
HTTP Status 405 - Request method 'GET' not supported
Example of my controller which throws the error:
@RequestMapping(value="example.html",method = RequestMethod.GET)
public String example(
@RequestParam(value = "q", defaultValue = "") String query,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
HttpServletRequest request, Model model) {
String template = "printout-blog";
model.addAttribute("q", query);
return template;
}