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

Hi,

 This is all a bit ugly from the HTTP RFC IMO. What would happen if you have several media types in Accept with charsets and also several charsets listed in Accept-Charset? Is there a definition of an “effective” Accept header that combines the information in Accept-Charset?

— Santiago

On Apr 9, 2018, at 4:54 PM, Markus KARG <markus@xxxxxxxxxxxxxxx> wrote:

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
 
 

 
-- 
_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jaxrs-dev


Back to the top