Tapestry 5
  1. Tapestry 5
  2. TAP5-156

Add a @QueryParameter annotation for parameters to event handler method

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.2.0
    • Component/s: None
    • Labels:
      None

      Description

      It would be nice, is some cases, to have Tapestry map query parameters to event handler method parameters, rather than path info. This is typically about the Ajax case, where it is more reliable (and easier) to take a URL and add query parameters to it than it is to add extra path info.

      public void onActionFromAjaxWidget(@QueryParameter("action") String widgetAction, @QueryParameter("count") int count)

      { .... }

        Activity

        Hide
        Filip S. Adamsen added a comment -

        If I may offer my perspective on this...

        I've recently implemented my own @QueryParameter annotation that is put on page fields. It's powered by a ComponentClassTransformWorker that injects the request parameter with the given name into the field.

        It's very simple right now, but it works. What's annoying is that I had to override PageLink, ActionLink, EventLink, and Form to take a map of query parameters to add to the URL. But it's worth it.

        I suppose it could be integrated into LinkFactory somehow, perhaps by enhancing each page class with a method that returns a map of all non-default query parameters that could then be added to each link sort of like the activation context - of course with an option to override it like you can override the page context.

        That's my $0.02 anyhow. I hope it made sense.

        Show
        Filip S. Adamsen added a comment - If I may offer my perspective on this... I've recently implemented my own @QueryParameter annotation that is put on page fields. It's powered by a ComponentClassTransformWorker that injects the request parameter with the given name into the field. It's very simple right now, but it works. What's annoying is that I had to override PageLink, ActionLink, EventLink, and Form to take a map of query parameters to add to the URL. But it's worth it. I suppose it could be integrated into LinkFactory somehow, perhaps by enhancing each page class with a method that returns a map of all non-default query parameters that could then be added to each link sort of like the activation context - of course with an option to override it like you can override the page context. That's my $0.02 anyhow. I hope it made sense.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development