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
}