I\'m learning how to build RESTful web services using Spring 4, and one thing I\'m not clear on is in @RequestMapping. I\'ve seen examples where one uses headers = \"Acce
As the javadoc of HeadersRequestCondition (which handles the value provided in the headers
attribute of a @RequestMapping
annotation) states
Expressions passed to the constructor with header names 'Accept' or 'Content-Type' are ignored. See ConsumesRequestCondition and ProducesRequestCondition for those.
So don't use those headers in headers
. Use the produces
and consumes
attributes for Accept
and Content-Type
.
As to how to use them, the documentation gives examples: for consumes and for produces.