Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-570

MultivaluedMap not filled in POST method

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.2.2.GA
    • 2.2.1, 2.3-beta-1
    • jaxrs
    • None
    • Hide

      Use this method
      @POST
      @Path("/")
      @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      @Produces(MediaType.APPLICATION_JSON)
      public String save(MultivaluedMap<String, String> formParams){
      }

      Show
      Use this method @POST @Path("/") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public String save(MultivaluedMap<String, String> formParams){ }

    Description

      When declaring a POST method with multivaluedMap as parameter, this map is never filled but should with all form parameters as described in the specification.
      After looking at the code, the problem comes from the method MessageBodyParameterInjector.isFormData().
      In this method the comparison of the first if statement is made between the constant mediaType APPLICATION_FORM_URLENCODED and the media type matched from the request.
      As the comparison is made on the toString value that render string like the following example (type/subtype;parameters), it can't be equal to constant media type toString value that never has parameters.

      So I made a patch, see attachment file.

      Patch explanation:
      The media type has to be APPLICATION_FORM_URLENCODED as required in the specification, I check that type and subtype are not wildcards and I check that constant media type and media type from request are compatible, I think that it corresponds to the need.

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            hcapitaine Harold Capitaine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: