I would like to use a suffix at the end of the URL in a Catalyst app to determine what format the response takes.
So http://foo/bar.json
would result in a json response, http://foo/bar.xml
in a xml one, and http://foo/bar
in a plain HTML page.
I was trying to do that in an initial bloc - in a begin
or auto
action - by rewriting the URL that's fed to dispatching for subsequent actions, but that does not seem to work.
And suggestions about this? Including objections - it might not be such a good idea after all.
Thanks -