You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2018/01/10 08:55:00 UTC

[jira] [Updated] (CXF-7607) JAXRS only consider the first "Accept" header in the request

     [ https://issues.apache.org/jira/browse/CXF-7607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang updated CXF-7607:
------------------------------
    Description: 
For example, If we have method like
{code}
        @GET
	@Path("/configuration")
	@Produces(MediaType.APPLICATION_OCTET_STREAM)
{code}
and request message header like
{code}
Accept-Encoding: gzip,deflate
Accept: application/vnd.vwg.mbb.vtsError_v1_0_0+xml
Accept: application/octet-stream
{code}
We will run into "HTTP 406 Not Acceptable "

However the request should be valid as the second "Accept" is
Accept: application/octet-stream
which match the 
@Produces(MediaType.APPLICATION_OCTET_STREAM)
so the request is acceptable. 

I checked the the W3C spec here[1], multiple "Accept" headers is allowed  and should be given same significance as if all the entries has been in one field.

[1]https://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z3

  was:
For example, If we have method like
{code}
        @GET
	@Path("/configuration")
	@Produces(MediaType.APPLICATION_OCTET_STREAM)
{code}
and request message header like
{code}
Accept-Encoding: gzip,deflate
Accept: application/vnd.vwg.mbb.vtsError_v1_0_0+xml
Accept: application/octet-stream
{code}
Will will run into "HTTP 406 Not Acceptable "

However the request should be valid as the Accept is
Accept: application/octet-stream
and match the 
@Produces(MediaType.APPLICATION_OCTET_STREAM)
so the request is acceptable. 

I checked the the W3C spec here[1], multiple "Accept" headers is allowed  and should be given same significance as if all the entries has been in one field.

[1]https://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z3


> JAXRS only consider the first "Accept" header in the request
> ------------------------------------------------------------
>
>                 Key: CXF-7607
>                 URL: https://issues.apache.org/jira/browse/CXF-7607
>             Project: CXF
>          Issue Type: Bug
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>
> For example, If we have method like
> {code}
>         @GET
> 	@Path("/configuration")
> 	@Produces(MediaType.APPLICATION_OCTET_STREAM)
> {code}
> and request message header like
> {code}
> Accept-Encoding: gzip,deflate
> Accept: application/vnd.vwg.mbb.vtsError_v1_0_0+xml
> Accept: application/octet-stream
> {code}
> We will run into "HTTP 406 Not Acceptable "
> However the request should be valid as the second "Accept" is
> Accept: application/octet-stream
> which match the 
> @Produces(MediaType.APPLICATION_OCTET_STREAM)
> so the request is acceptable. 
> I checked the the W3C spec here[1], multiple "Accept" headers is allowed  and should be given same significance as if all the entries has been in one field.
> [1]https://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z3



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)