Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Support for Accept-Charset

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

 

From: jaxrs-dev-bounces@xxxxxxxxxxx [mailto:jaxrs-dev-bounces@xxxxxxxxxxx] On Behalf Of Christian Kaltepoth
Sent: Samstag, 7. April 2018 09:54
To: jaxrs developer discussions
Cc: Florian Hirsch
Subject: [jaxrs-dev] Support for Accept-Charset

 

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.

 

See this example:

 

  Accept: text/html; charset=iso-8859-15

  Accept-Charset: utf-8

 

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.

 

Even worse:

 

  Accept: text/html

  Accept-Charset: iso-8859-15

 

This results in "text/html" being passed to the MBW.

 

Is this expected behavior? 

 

Any thoughts?

 

Christian

 

 


 

--


Back to the top