When it comes to REST services, Symfony developers (and cookbooks) tend to base the choice of resource representation on file extension rather than content negotiation (see this stackoverflow question).
Example:
article_show:
pattern: /articles/{culture}/{year}/{title}.{_format}
defaults: { _controller: AcmeDemoBundle:Article:show, _format: html }
requirements:
culture: en|fr
_format: html|rss
year: \d+
Is there a Bundle/way of implementing proper content negotiation on the server side?
Implementing a switch/case style algorithm with _format
and encoders
in the Controller is the only way to get there?
Checkout https://github.com/FriendsOfSymfony/FOSRestBundle, section "Format listener" ...