IMHO…
…this is a bug in the JAX-RS spec:
Accept Used by runtime when selecting a resource method, compared to value of
@Produces annotation, see Section 3.5.
Accept-Charset Processed by runtime if application uses Request.selectVariant
method, see Section 10.2.4.
As a result, unless the application explicitly uses Request.selectVariant, the Accept-Charset header is completely ignored! I cannot see that anybody really wants that.
We should fix that, but fixing it means we will break existing code. So maybe we should be careful and queue for 3.0?
-Markus
Hi all,
while working on JSR 371, we ran into some problems I would like to bring up.
HTTP allows the client to request a specific charset using the "Accept-Charset" request header. Unfortunately this header seems to be ignored by JAX-RS.
Accept: text/html; charset=iso-8859-15
This will result in a media type "text/html; charset=iso-8859-15" being provided to the MBW in Jersey. I see that there are multiple "sources" for the preferred charset by the client (the charset parameter of the media type and the "Accept-Charset" header). But the HTTP RFC definitely prefers the "Accept-Charset" header.
Accept-Charset: iso-8859-15
This results in "text/html" being passed to the MBW.
Is this expected behavior?