> -----Original Message-----
> From: KARR, DAVID
> Sent: Thursday, September 15, 2011 11:23 AM
> To: [email protected]
> Subject: Why isn't a service similar to another one not respecting the
> "Accept" header?
> 
> I've had a CXF-based REST service in production for a little while.  It
> changes its response format either with the "Accept" header, or by
> extension.  I get xml with "Accept:application/xml" or if I add the
> ".xml" suffix to the request.  Similarly, I get JSON with the analogous
> values for JSON.  This service is using Jackson for its JSON
> representation.
> 
> I now have another service that will go to production soon.  Using the
> suffix for xml or json works fine.  However, it seems to ignore the
> "Accept" header.  My "@Produces" annotation has both "application/json"
> and "application/xml", in that order.  I get JSON by default, and I
> still get JSON if I send "Accept:application/xml" as an HTTP header.
> 
> Just to make sure, I retested this same mechanism with the other
> service, and it correctly changes the format based on the "Accept"
> header.
> 
> One difference between the two services is that the new service isn't
> using Jackson, it's using the default (Jettison, I assume).  Otherwise,
> the "jaxrs:server" and other configuration is almost identical between
> the two services.

Another difference is that the new service is using CXF 2.4.2, and the older 
service is using CXF 2.3.3.

> Before I start pasting in my configuration and code, are there any
> simple reasons why this might not be working?

Reply via email to