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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        557d 19h 44m 1 Howard M. Lewis Ship 02/Mar/10 17:10
        In Progress In Progress Closed Closed
        8h 46m 1 Howard M. Lewis Ship 03/Mar/10 01:57
        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 Add a @QueryParameter annotation for parameter to event handler method Add a @QueryParameter annotation for parameters to event handler method
        Howard M. Lewis Ship made changes -
        Summary Add an @QueryParameter annotation for parameter to event handler method Add a @QueryParameter annotation for parameter to event handler method
        Howard M. Lewis Ship made changes -
        Summary Annotation to map query parameter to event handler method Add an @QueryParameter annotation for parameter to event handler method
        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) { .... }

        This does raise some tricky questions: i.e., what do you do when only some of the parameters have @QueryParameter?
        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) { .... }
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Affects Version/s 5.0.15 [ 12313429 ]
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Component/s tapestry-core [ 12311285 ]
        Key TAPESTRY-2613 TAP5-156
        Affects Version/s 5.0.14 [ 12313214 ]
        Project Tapestry [ 10573 ] Tapestry 5 [ 12310833 ]
        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.
        Howard M. Lewis Ship created issue -

          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