users@jersey.java.net

ViewProcessor - how to set the response content-type

From: Alex Treppass <alextreppass_at_googlemail.com>
Date: Fri, 19 Feb 2010 16:47:53 +0000

I've rolled my own ViewProcessor implementation to use the Apache Velocity
template engine.

In my writeTo(resolvedPath, viewable, outputstream) method I merge / render
the template and flush it out, which works fine. Opera and IE are kind
enough to render the given page as .html, but Chrome likes to request
text/xml so it seems the server is sending it back as this.

Is there a way to set the content-type header in Viewables as you would
with Response.ok("<response>", MediaType.TEXT_HTML)?

Thanks in advance,

Alex