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] [Created] (CXF-6076) MediaType parameter not parsed correctly
Date Fri, 31 Oct 2014 14:43:33 GMT
Ken Meyer created CXF-6076:
------------------------------

             Summary: 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: 3.0.2, 2.7.13, 2.7.10
            Reporter: Ken Meyer
             Fix For: 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