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

MultivaluedMap not filled in PUT method because of too restrictive condition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3-beta-1
    • 2.3-beta-1
    • jaxrs
    • None
    • Hide

      Use this method on a jetty server

      @PUT
      @Path("/

      {pathParam}

      ")
      @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      @Produces(MediaType.APPLICATION_JSON)
      public String modify(MultivaluedMap<String, String> parameterMap){
      }

      Show
      Use this method on a jetty server @PUT @Path("/ {pathParam} ") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public String modify(MultivaluedMap<String, String> parameterMap){ }

      This bug is not a duplicate of RESTEASY-570
      When declaring a PUT method with multivaluedMap as parameter, this map is never filled but should with all form parameters as described in the specification.
      The problem comes from a hack made apparently for Tomcat but this hack seems a little bit too restrictive.
      In the method HttpServletInputMessage.getDecodedFormParameters() the first if statement concerns the request method, if the value is PUT so invoke getPutDecodedFormParameters() and read parameters from the body content by reading an input stream else get parameters from Request.getParameters().
      According to the comment, this has been made because Tomcat always returns an empty if Request.getParameters is invoke.
      But in my case with a Jetty server the map is filled and the body stream is empty.
      So I think that the test should be changed to first asserts the map is not empty and finally the request method is PUT.
      See the patch file in attachment.
      I also moved the test that checks if the decodedParameters is not null as the first instruction.

        1. patch.txt
          1 kB
          Harold Capitaine

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

                Created:
                Updated:
                Resolved: