I have a RESTful web service developed using Spring MVC and without any configuration I can return objects from my @ResponseBody
annotated controller methods that get serialized to JSON. This works as soon as the Accept header in the request is not set or is application/json
.
As I'm getting inspired by the GitHub API specification, I wanted to implement custom mime type for my API as GitHub does, for example: application/vnd.myservice+json
. But then I need to tell Spring MVC that my controllers can provide this mime type and that it should be serialized by Json (i.e org.springframework.web.servlet.view.json.MappingJacksonJsonView class).
Any idea how to do it?