1
我想在Catalyst应用程序的URL末尾使用后缀来确定响应所采用的格式。我可以重写提供给Catalyst的URL吗?
因此http://foo/bar.json
会导致json响应,http://foo/bar.xml
在xml中,而http://foo/bar
在纯HTML页面中。
我正在尝试在最初的区块中执行此操作 - 在begin
或auto
操作中 - 通过重写用于后续操作的调度URL,但似乎不起作用。
有关于此的建议?包括反对意见 - 毕竟这可能不是一个好主意。
谢谢 -
如何制作“http:// foo.com/bar/json”,“http:// foo.com/bar/xml”等形式的网址,然后使用此解决方案:http: //stackoverflow.com/questions/4408408/what-is-the-best-way-to-hanlde-optional-url-arguments-in-a-catalyst-controller – 2014-09-24 08:40:16