cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-7310) org.apache.cxf.jaxrs.client.ClientProxyImpl#getAccept does not handle Accept header with multiple media types
Date Mon, 03 Apr 2017 11:02:41 GMT

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

Sergey Beryozkin resolved CXF-7310.
-----------------------------------
       Resolution: Fixed
         Assignee: Sergey Beryozkin
    Fix Version/s: 3.2.0
                   3.1.11
                   3.0.13

> org.apache.cxf.jaxrs.client.ClientProxyImpl#getAccept does not handle Accept header with
multiple media types
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-7310
>                 URL: https://issues.apache.org/jira/browse/CXF-7310
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.10
>            Reporter: Roman
>            Assignee: Sergey Beryozkin
>             Fix For: 3.0.13, 3.1.11, 3.2.0
>
>
> The org.apache.cxf.jaxrs.client.ClientProxyImpl#getAccept method does not handle an accept
header with multiple media types like so:
> {code}
> Accept: application/json, text/plan, */*
> {code}
> It throws an exception:
> {code}
> Caused by: java.lang.IllegalArgumentException: Invalid media type string: application/json,
text/plain, */*
> 	at org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.internalValueOf(MediaTypeHeaderProvider.java:90)
> 	at org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.valueOf(MediaTypeHeaderProvider.java:65)
> 	at org.apache.cxf.jaxrs.utils.JAXRSUtils.toMediaType(JAXRSUtils.java:1723)
> 	at org.apache.cxf.jaxrs.client.ClientProxyImpl.getAccept(ClientProxyImpl.java:396)
> 	at org.apache.cxf.jaxrs.client.ClientProxyImpl.setRequestHeaders(ClientProxyImpl.java:367)
> {code}
> I think the Accept header value needs to be split by ',' and each part passed to JAXRSUtils.toMediaType(...)
to parse each correctly in this code:
> {code}
> for (String s : headers) {
>     types.add(JAXRSUtils.toMediaType(s));
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message