title: Add custom headers to response after "render as JSON"
body: <p>I am trying to add a custom HTTP header to the response of a certain set of controllers using Grails Filters:</p>
  
  <pre><code>class ApiFilters {
     def filters = {
        xwingFilter(uri:'/api/**') {
           after = {
              response.setHeader('X-Wing', 'foo')
           }
        }
     }
  }
  </code></pre>
  
  <p>If the controller renders a view or text, the header gets added to the response.
  If the controller uses "render as JSON" the header is not added. It looks like the JSON converter is closing the output stream and sending it right away. Is that right?</p>
  
  <p>I could use Grails interceptors but I'd have to replicate it in more than one controller.
  Any ideas on how can I achieve this?</p>