I want to serve different content types based on the Accept
header I receive at a RESTful endpoint.
application/myapp-v1.0+json
application/myapp-v1.0+xml
Is there any way to do this with @ResponseBody
? It seems like a convenient shortcut by allowing me to just return an object and let the HttpMessageConverter
handle invoking Jackson but I just cannot get it working. 406 responses any time I wire up more than one MimeType.
For this iteration I've ended up querying the request header myself and returning the appropriate view handler myself, but I wouldn't mind revisiting this in future.