Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-533

Support multi-value type hints (eg. @TypeHint=String[])

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3
    • Servlets
    • None

    Description

      As discussed in SLING-522, when posting a single value to a property that should be multi-valued, an extension to the @TypeHint is needed that allows the explicit definition of a multi-value type. For example, for Strings this would be @TypeHint=String[].

      Based on a quick look at the code, it should happen in o.a.s.servlets.post.impl.helper.SlingPropertyValueHandler.setPropertyAsIs(). First of all the parsing of the getTypeHint() must be changed to look for an ending [] first, and then this "isMultiValued" information must be used to call the multi-value version of setProperty() in all cases (values.length >= 0).

      Attachments

        1. multival-post-test.html
          2 kB
          Alexander Klimetschek

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              alexander.klimetschek Alexander Klimetschek
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: