If I send a request to my service without setting the "Accept" header, I get 
XML back.  In the service, I check "acceptableMediaTypes", and it's 
"application/xml".

If I set the "Accept" request header to "application/json", I get JSON back.  
In the service, I check "acceptableMediaTypes", and it's "application/json".

I set the "_type" query parameter to "json", I get JSON back.  In the service, 
I check "acceptableMediaTypes", and it's "application/json".

Everything's fine so far.  The next test has the problem.

I have an interceptor that looks for certain query parameters and translates 
them to header parameters.  One of the keys it looks for is "Accept".  I set 
the "Accept" query parameter to "application/json".  I watched my interceptor 
execute the following line:

    ((Map<String, List<String>>) 
inMessage.get(Message.PROTOCOL_HEADERS)).put(key, list);

Where "key" was "Accept", and "list" was a one-element list containing the 
value "application/json".

Inside the service, I printed the value of "acceptableMediaTypes", and it's 
"application/json".

However, when the service rendered the response, it was XML, not JSON.

What could I be missing?

Reply via email to