On Jan 21, 2009, at 12:10 PM, amsmota_at_gmail.com wrote:
> I searched the archives and although there are many things about
> conneg the ones I saw are basically of the type
>
> Accept: xxx/xxx
> @Produces({"application/xml", "application/json"})
>
> But my question is the opposite, in concrete
>
> Accept: application/octet-stream, application/pdf
>
> @Produces("text/html")
> produceHtml()
>
> @Produces("application/pdf")
> producePdf()
>
> I was expecting the producePdf being executed, but I got the html one.
Jersey should match producePdf if the Accept header is as you state.
What version of Jersey are you using? are you sure the Accept header
sent in the request is as you state?
The reason i am suspect is text/html in no way matches application/
octet-stream nor application/pdf.
If you can send a simple project that reproduces the error that would
help me debug.
> How does Jersey handles situations like this?
>
It should work, otherwise it is a bug.
> Also, does Jersey considers the quality values when matching mime
> types?
>
Yes, quality values of media types in the accept header but not
currently of media types in the @Produces.
Paul.