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

@Form does not inject map properties with non-alphabetic keys

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.3.6.Final, 3.0-beta-4
    • 2.3.4.Final, 2.3.5.Final
    • jaxrs
    • None

    Description

      Using @Form and @FormParam, it is not possible to have RESTEasy inject values to a Map when the request parameter names are non-alphabetic. For instance, if we have a request parameter:

      myMap[b794c4a0-14b7-0130-c2da-20c9d04983db].bar=test
      

      And @Form/@FormParam annotated classes:

          public class MyForm
          {
              @Form( prefix = "myMap" )
              private Map<String, Foo> myMap = Maps.newHashMap();
          }
      
          public class Foo
          {
              @FormParam( "bar" )
              public void setBar( final String bar )
             { ... }
          }
      

      And a resource accepting a form-url-encoded POST:

          @Path( "/test" )
          public class MyController
          {
              @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
              @POST
              public void doPost( @Form final MyForm myForm )
              { ... }
          }
      

      The myForm.myMap will not have an entry with a key "b794c4a0-14b7-0130-c2da-20c9d04983db".

      It looks like the problem occurs because of a regex in MapFormInjector. The regex ("^" + prefix + "\\[([a-zA-Z_]+)
      ]") only allows alphabetic characters and underscore characters when matching form parameters.

      Attachments

        Issue Links

          Activity

            People

              weli@redhat.com Weinan Li
              jreiter_jira John Reiter (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: