[ 
https://issues.apache.org/jira/browse/CXF-7310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15953296#comment-15953296
 ] 

Roman commented on CXF-7310:
----------------------------

[~serg.berezhnoy] thank you. 3.1.10 is used by latest camel-cxf and this was 
not working. I will raise an issue in Apache Camel project to update this 
dependency ASAP. 

Cheers
R

> 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)

Reply via email to