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

@FormParam does not work with PUT method when a Query param is present

XMLWordPrintable

    • Hide

      Create a PUT method with @FormParam

       
      @PUT
      @Path("/api/{pathparam:\\d+}")
      @Consumes("application/x-www-form-urlencoded")
      @Produces({"application/xml", "application/json"})
      public void updateGuestPostStatus(	@PathParam("pathparam") Long pathparam, 
      					@FormParam("formParam") String formParam)
      

      And call the URL with a query param as well as the form param. The form param won't be retrieved.

      Show
      Create a PUT method with @FormParam @PUT @Path( "/api/{pathparam:\\d+}" ) @Consumes( "application/x-www-form-urlencoded" ) @Produces({ "application/xml" , "application/json" }) public void updateGuestPostStatus( @PathParam( "pathparam" ) Long pathparam, @FormParam( "formParam" ) String formParam) And call the URL with a query param as well as the form param. The form param won't be retrieved.

      The issue is still present in version 3.0.9

      I have the following method in my code

       
      @PUT
      @Path("/api/{pathparam:\\d+}")
      @Consumes("application/x-www-form-urlencoded")
      @Produces({"application/xml", "application/json"})
      public void updateGuestPostStatus(	@PathParam("pathparam") Long pathparam, 
      					@FormParam("formParam") String formParam)
      

      When calling PUT /api/100000588600
      With content type application/x-www-form-urlencoded
      And content

      formParam=PRESENT

      It works well, I have the variable formParam set..

      But when I call PUT /api/100000588600?something
      with the same content

      The variable formParam is null.

      This did not use to happen with Resteasy 2.0.1.GA.

      Actually, this is this code change which broke the behavior:
      https://github.com/resteasy/Resteasy/commit/bc78212fa2744df72d82b0a025bc1b7dcb97aeb7

      Since the request's parameterMap is not empty, it does not load the form parameters.

      Is there a right reason to not allow FormParm on PUT method call on an URL with query parameters ?

      Thank you.

            thofman Tomas Hofman
            gill80_jira Jean-Noël Mauclair (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: