Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6076

MediaType parameter not parsed correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.10, 2.7.13, 3.0.2
    • 3.0.3, 2.7.14, 3.1
    • JAX-RS
    • None
    • Unknown

    Description

      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 }

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            ken.meyer Ken Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: