When I invoke this URL in the browser:
http://localhost:8080/app/foo.json
Spring responds with 406 Status code in this error message:
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ().
However I have defined my content negotiating view resolver like this:
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="favorPathExtension" value="true" />
<property name="ignoreAcceptHeader" value="true" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json"/>
<entry key="html" value="text/html"/>
</map>
</property>
</bean>
And my controller is defined like this:
@Controller
@RequestMapping(value = "/foo")
public class ToowootController {
@RequestMapping(method = GET)
@ResponseBody
public FooDTO index() {
// return fooDTO
}
}
Any ideas what am I doing wrong?