Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-149

LinkTool.addRequestParams methods are difficult to use from VTL due to their String[] parameter type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0.x, 3.0
    • None
    • None
    • Velocity 1.7, Velocity-Tools 2.0

    Description

      If I call addRequestParams() with no argument, things work as expect. On the other hand, this does not work:

      #set($ignoreList = ['foo'])
      $link.relative('/bar').addRequestParamsExcept($ignoreList)

      I get an invalid reference log message and the above "$link..." text is rendered as written instead of evaluating successfully.

      The problem is that the ignoreList is a List and it needs to be String[]. Velocity will auto-convert Lists into Object[] if appropriate, but the resulting object type is Object[] and not String[].

      There does not appear to be a way to create a String[] from a Velocity template, so using addRequestParams and the other, similar methods will be very difficult to use with an argument.

      LinkTool.addRequestParams and friends should be modified to accept Object[] arguments.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chris@christopherschultz.net Christopher Schultz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: