In Spring MVC 3.x I can configure a ContentNegotiatingViewResolver bean to automatically render any given endpoint in either JSON or XML simply by changing the file extension to .json or .xml. I assumed there was an equivalent functionality in Grails but I can't find it.
Everything I've read says I have to catch the incoming mime-type (using withFormat) and then specify the JSON output using render as JSON (or equivalent) in every one of my controller methods (e.g. rendering JSON with Grails?). Before I dive in and start adding JSON-specific code to my controllers I thought I'd ask here...
So my question is: Can I configure Grails 2 to automatically produce JSON output by simply adding a `.json' file extension (or changing the accept header) for any given URL?