Uploaded image for project: 'Cocoon'
  1. Cocoon
  2. COCOON-1697

Allow request parameters to be used in "for (var k in h)" kind of Javascript Loops

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.1.8
    • None
    • * Cocoon Core, - Flowscript
    • None
    • Patch available

    Description

      As far as I can see, in the "cocoon" object passed to the flow environment, I always have to access the request parameter names and all values as Java Enumeration(s), therefore, I can't use the "for (var name in array)" kind of loop.

      All I want to do is something extremely simple, like this:

        for (var name in cocoon.request.parameters) {
          print("PARAMETER -> " + name);
          print(" VALUE -> " + cocoon.request.parameters[name]);
          print(" LENGTH -> " + cocoon.request.parameters[name].length);

          for (var position in cocoon.request.parameters[name]) {
            var value = cocoon.request.parameters[name][position];
            print (" @[" + position + "] => " + value);
          }
        }

      Apparently, but I might have overlooked something, there's currently no way of doing this.

      I've created a simple patch, that allows the above mentioned flowscript to work.

      Attachments

        1. FOM_RequestParameters-2.1.9.patch.txt
          6 kB
          Ross McDonald
        2. FOM_Cocoon-2.1.9.patch.txt
          1.0 kB
          Ross McDonald
        3. ASF.LICENSE.NOT.GRANTED--patch.txt
          7 kB
          Pier Fumagalli

        Activity

          People

            Unassigned Unassigned
            pier Pier Fumagalli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: