users@jersey.java.net

AW: [Jersey] MessageBodyWriter for multiple media types

From: Christian Helmbold <christian.helmbold_at_yahoo.de>
Date: Sat, 7 Aug 2010 19:03:01 +0000 (GMT)

Hi Paul, thanks for your answer. I agree that it would be easier to follow the usual JAX-RS content negotiation model with @Produces on resource methods. Furthermore I decided to restrict each MessageBodyWriter to a single content type, what makes conneg straight forward and simple. But there are new questions: * If a template cannot be found in my MessageBodyWriter I throw a WebApplicationException(406), but it would be possible that there is another (second best) matching representation which would be ignored then. - Is it possible to resume the lookup for a matching MessageBodyWriter? - Is it possible to tell the client what other representations he could get? see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7 * How can I set the "charset"? I tried @Produces("text/html; charset=UTF-8") but that was ignored. Then I tried to add another ContentType header in the writeTo method of the MessageBodyWriter, but then I got only the charset without the content type (I'd like to use the ContentType from @Produces automatically). Christian -- http://scala-forum.org/