【发布时间】:2011-12-12 11:10:39
【问题描述】:
在 REST 服务方面,Symfony 开发人员(和说明书)倾向于根据文件扩展名而不是内容协商(see this stackoverflow question)来选择资源表示。
例子:
article_show:
pattern: /articles/{culture}/{year}/{title}.{_format}
defaults: { _controller: AcmeDemoBundle:Article:show, _format: html }
requirements:
culture: en|fr
_format: html|rss
year: \d+
是否有在服务器端实现正确内容协商的 Bundle/方式?
在 Controller 中使用 _format 和 encoders 实现 switch/case 样式算法是实现目标的唯一方法吗?
【问题讨论】: