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

Allow collections of objects in a form object

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.2-beta-1
    • Fix Version/s: 2.3.4.Final
    • Component/s: jaxrs
    • Labels:

      Description

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  bill.burke Bill Burke
                  Reporter:
                  m.winkels Maarten Winkels
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: