Tapestry 5
  1. Tapestry 5
  2. TAP5-937

LinkImpl does not handle parameters properly when passed into the constructor

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1
    • Fix Version/s: 5.2.0
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I noticed this after using the AjaxFormLoop AddRowLink on a page which has an onActivate and onPassivate resulting in the addition of a "t:ac" to the url. Debugging showed me that the t:ac is already present on instantiation of the LinkImpl. When calling toAbsoluteUri the parameters are added in a way where they will always start with a "?". Obvisouly resulting in an invalid URL with two ?'s

      I'm building a failing test at this stage and will provide a patch once resolved.

        Activity

        Hide
        Joost Schouten added a comment -

        this patch will make sure that added parameters start with a ? when no params are available in the base uri yet, and a & when parameters are already available.

        Show
        Joost Schouten added a comment - this patch will make sure that added parameters start with a ? when no params are available in the base uri yet, and a & when parameters are already available.
        Hide
        Joost Schouten added a comment -

        The problem only exists when using any UrlRewriteRule, activation context and additional parameters. The t:ac seems to be added to the URL before the UrlRewriting happens, where the AjaxFormLoop parameters seem to be added after the rewriting which results in the buildURI being called twice, causing the double questionmark.

        Show
        Joost Schouten added a comment - The problem only exists when using any UrlRewriteRule, activation context and additional parameters. The t:ac seems to be added to the URL before the UrlRewriting happens, where the AjaxFormLoop parameters seem to be added after the rewriting which results in the buildURI being called twice, causing the double questionmark.
        Hide
        Joost Schouten added a comment -

        patch checks if the baseURI already contains a '?', if so start adding the new params with an '&', otherwise start with a '?'. Also added a test for a situation where a base URI with parameters on the path in instantiated.

        Show
        Joost Schouten added a comment - patch checks if the baseURI already contains a '?', if so start adding the new params with an '&', otherwise start with a '?'. Also added a test for a situation where a base URI with parameters on the path in instantiated.
        Hide
        Igor Drobiazko added a comment -

        Thanks.

        Show
        Igor Drobiazko added a comment - Thanks.

          People

          • Assignee:
            Igor Drobiazko
            Reporter:
            Joost Schouten
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development