Tapestry 5
  1. Tapestry 5
  2. TAP5-961

When a URL rewriting rule changes the path for a rendered link (component event or page render), any query parameters associated with the original link are lost

    Details

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

      Description

      When a link is rewritten that contains parameters, the parameter information is not passed along to the newly created link. This creates a problem, for example, when the activation context "t:ac" is specified as a parameter in event links.

      Link rewriteIfNeeded(Link link, URLRewriteContext context)
      {
      Link newLink = null;
      SimpleRequestWrapper fakeRequest = new SimpleRequestWrapper(request, link.toAbsoluteURI());

      Request rewritten = urlRewriter.processLink(fakeRequest,context);

      // if the original request is equal to the rewritten one, no
      // rewriting is needed
      if (fakeRequest != rewritten)

      { final String originalServerName = request.getServerName(); final String rewrittenServerName = rewritten.getServerName(); boolean absolute = originalServerName.equals(rewrittenServerName) == false; final String newPath = rewritten.getPath(); String newUrl = absolute ? fullUrl(rewritten) : newPath; newLink = new LinkImpl(newUrl, false, false, response, null); (edit: ** newLink needs parameter information specified here) }

      return newLink;

      }

      1. tap5-961.patch
        0.7 kB
        Richard Bolkey

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          55d 23h 59m 1 Howard M. Lewis Ship 23/Feb/10 19:37
          In Progress In Progress Closed Closed
          1h 1 Howard M. Lewis Ship 23/Feb/10 20:37
          Christian Riedel made changes -
          Link This issue is duplicated by TAP5-1194 [ TAP5-1194 ]
          Howard M. Lewis Ship made changes -
          Status In Progress [ 3 ] Closed [ 6 ]
          Fix Version/s 5.2.0 [ 12314122 ]
          Resolution Fixed [ 1 ]
          Howard M. Lewis Ship made changes -
          Summary ComponentEventLinkEncoderMethodAdvice#rewriteIfNeeded drops parameters when rewriting links. When a URL rewriting rule changes the path for a rendered link (component event or page render), any query parameters associated with the original link are lost
          Priority Major [ 3 ] Critical [ 2 ]
          Hide
          Howard M. Lewis Ship added a comment -

          Also, this is a chance to remove the gratuitous use of method advice (rather than decoration). Advice is when the underlying interface is not known, decoration is smarter when it is known (such as in this case, when a decorator is being put specifically around the ComponentEventLinkEncoder service).

          Show
          Howard M. Lewis Ship added a comment - Also, this is a chance to remove the gratuitous use of method advice (rather than decoration). Advice is when the underlying interface is not known, decoration is smarter when it is known (such as in this case, when a decorator is being put specifically around the ComponentEventLinkEncoder service).
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Howard M. Lewis Ship made changes -
          Assignee Howard M. Lewis Ship [ hlship ]
          Richard Bolkey made changes -
          Field Original Value New Value
          Attachment tap5-961.patch [ 12429082 ]
          Hide
          Richard Bolkey added a comment -

          Adding a patch (albeit untested).

          Show
          Richard Bolkey added a comment - Adding a patch (albeit untested).
          Richard Bolkey created issue -

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Richard Bolkey
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development