On 29/11/11 10:13, Sergey Beryozkin wrote:
Hi
On 29/11/11 01:19, douglassparker wrote:
If a server method is annotated with @Produces(
{MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML} ) and the client does not provide an Accept
Header, my understanding is that the response MIME type should default to
the FIRST Mime type listed, JSON in this case. (I believe Jersey works
like
this.) But it doesn't. It defaults to XML. Isn't this a violation of the
spec?

Are you talking about the CXF server side choosing JSON in this case ? I
don't think the spec says anything at all about what to offer in case of
a missing Accept type, if a client does not mind then given that the
server says it can serve either JSON or XML, then it means both formats
are perfectly fine in case of a missing Accept


Forgot to mention, you can use server side qualifiers to affect this, CXF uses 'q', in 2.0 it will be 'qs'

{MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML;q=0.8}

That will always give you JSON in cases when Accept is not set

Cheers, Sergey

Reply via email to