tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiago H. de Paula Figueiredo (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2225) Create client-side API to call a component's event handler methods
Date Wed, 09 Mar 2016 20:05:40 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15187822#comment-15187822
] 

Thiago H. de Paula Figueiredo commented on TAP5-2225:
-----------------------------------------------------

Hello, [~jkemnade]! I'm sorry for the very late answer.

Yes, in my plan, the search goes bottom up. If there's no event information inside the HTML
generated by the component, it goes up until it reaches the page. It doesn't even need special
treatment.

I believe the recommended way is to avoid creating URLs to events in the client-side completely
and use query parameters for the dynamic parts. That's exactly why I think my proposal is
better than yours for this ticket. The client side cannot guess what the event URLs are (it
doesn't even know what the events are to begin with) nor try to add or change activation context
values, as, unless we do Java-to-JS compilation, it isn't possible to guarantee the URL encoding
will be the same server- and client-side. That's why I think the event URLs should be created
client-side and put in data attributes in some way that we can build a JS API which encapsulates
all of this.

I'm also against skipping checks for decoding. For simplicity, consistency and bug avoidance,
the encoding and decoding should always lead to the same results (if I decode and then encode
then decode the same string, it should match the original value), all that IMHO, of course.

Nice discussion, by the way. :)

> Create client-side API to call a component's event handler methods
> ------------------------------------------------------------------
>
>                 Key: TAP5-2225
>                 URL: https://issues.apache.org/jira/browse/TAP5-2225
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.4
>            Reporter: Jochen Kemnade
>            Assignee: Thiago H. de Paula Figueiredo
>              Labels: ajax, event, handler, javascript
>
> It should be possible to create URLs for components' event handlers on the client side.
> There could be a function that mirrors the behavior of ComponentResources#createEventLink.
It might be passed an event name or an object with additional information such as a page name,
a request context, or additional request parameters.
> The function could either return the URL or a function that makes an XHR and passes the
response to a callback.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message