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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.x
    • Component/s: None
    • Labels:
      None
    • Environment:
      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.

        Activity

        Hide
        chris@christopherschultz.net Christopher Schultz added a comment -

        Fixed in r1151648.

        • Change methods to accept Object[] instead of String[].
        Show
        chris@christopherschultz.net Christopher Schultz added a comment - Fixed in r1151648. Change methods to accept Object[] instead of String[].

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development