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

Allow collections of objects in a form object

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 2.3.4.Final
    • 2.2-beta-1
    • jaxrs

      In some situations, I would like to be able to post a form with a number of components that should be mapped to collections in a form object. For example these post values:

      telephoneNumbers[0].countryCode=31
      telephoneNumbers[0].number=0612345678
      telephoneNumbers[1].countryCode=91
      telephoneNumbers[1].number=9717738723
      
      address[INVOICE].street=Main Street
      address[INVOICE].houseNumber=2
      address[SHIPPING].street=Square One
      address[SHIPPING].houseNumber=13
      

      Should be mapped to the following structure:

      public class Person {
        @Form(prefix="telephoneNumbers") List<TelephoneNumber> telephoneNumbers;
        @Form(prefix="address") Map<String, Address> adresses;
      }
      
      public class TelephoneNumber {
        @FormParam("countryCode") private String countryCode;
        @FormParam("number") private String number;
      }
      
      public class Address {
        @FormParam("street") private String street;
        @FormParam("houseNumber") private String houseNumber;
      }
      

      I want to contribute this to RESTEasy.

            patriot1burke@gmail.com Bill Burke (Inactive)
            m.winkels Maarten Winkels (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: