cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Meyer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6076) MediaType parameter not parsed correctly
Date Tue, 04 Nov 2014 11:46:33 GMT

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

Ken Meyer commented on CXF-6076:
--------------------------------

Thanks for reviewing and correcting the issue :-).  One question if I can?

Why would the test case, testTypeWithExtendedParametersQuote(), not be valid?  

The reason I ask is that according to the spec (sorry don't have the number in front of me),
that the number could be either quoted string or not depending on the characters used (e.g.
"boundary" is quoted because it uses an illegal character, colon). Is quoted string only used
in that situation?

Thanks again,

Ken Meyer




> MediaType parameter not parsed correctly 
> -----------------------------------------
>
>                 Key: CXF-6076
>                 URL: https://issues.apache.org/jira/browse/CXF-6076
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.10, 2.7.13, 3.0.2
>            Reporter: Ken Meyer
>            Assignee: Sergey Beryozkin
>             Fix For: 3.1.0, 3.0.3, 2.7.14
>
>
> When MediaType parameter contains a plus symbol (+), the parameter is parse incorrectly.
This appears to be the result of the RegEx Pattern, COMPLEX_PARAMETERS, used in class  org.apache.cxf.jaxrs.impl.MediaTypeHeaderProvider.
> org.apache.cxf.jaxrs.impl.MediaTypeHeaderProviderTest
> Some test cases:
>     @Test
>     public void testTypeWithExtendedParameters() {
>         MediaType mt = MediaType.valueOf("multipart/related;type=application/dicom+xml");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(1, params2.size());
>         assertEquals("application/dicom+xml", params2.get("type")); //SUCCESSFUL
>     }
>     @Test
>     public void testTypeWithExtendedParametersQuote() {
>         MediaType mt = MediaType.valueOf("multipart/related;type=\"application/dicom+xml\"");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(1, params2.size());
>         assertEquals("application/dicom+xml", params2.get("type")); //FAIL
>     }    
>     
>     @Test
>     public void testTypeWithExtendedAndBoundaryParameter() {
>         MediaType mt = MediaType.valueOf("multipart/related; type=application/dicom+xml;
boundary=\"uuid:b9aecb2a-ab37-48d6-a1cd-b2f4f7fa63cb\"");
>         
>         assertEquals("multipart", mt.getType());
>         assertEquals("related", mt.getSubtype());
>         Map<String, String> params2 = mt.getParameters();
>         assertEquals(2, params2.size());
>         assertEquals("\"uuid:b9aecb2a-ab37-48d6-a1cd-b2f4f7fa63cb\"", params2.get("boundary"));
>         assertEquals("application/dicom+xml", params2.get("type")); //FAIL
>     }  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message