Thought I'd share what finally worked with this. In the end, it turned out to 
be pretty simple. We just:
-  Implemented ComponentEventLinkEncoder.createComponentEventLink, wherein we 
a) Return a Link with the URL of our choice and b) Stash away the associated 
ComponentEventRequestParameters object in a application-scoped map, keyed off 
both the current user and the ComponentEventRequestParameters object generated 
by Tapestry. The link also has a query param for the map key (int hash code 
value).
- Implemented Dispatcher.dispatch, wherein we check each request for the above 
query param. If not there, just return false to delegate request processing. If 
found, we use it to lookup the ComponentEventRequestParameters from the map and 
call componentRequestHandler.handleComponentEvent(componentEventReqParams).
Not saying it is the only (or best) way to do it, but working nicely so far. 
Thanks for all the other tips!

Mike


From: Mike Dunbar
Sent: Monday, April 09, 2012 11:51 AM
To: 'users@tapestry.apache.org'
Subject: Need Help With Event URL Rewriting

Hi,
We are trying to build an application with RESTful URLs, rather than the 
out-of-box Tapestry URLs. We've been able to do this for our page URLs by using 
Tynamo tapestry-routing (http://tynamo.org/tapestry-routing+guide). We would 
like to do the same thing for the event link URLs contained on our pages. I'm 
experimenting with ComponentEventLinkEncoder and have been able to use 
createComponentEventLink to return an event Link with an arbitrary URL. 
However, when the link is clicked Tapestry does not recognize this as a 
component event request, and hence doesn't call the decodeComponentEventRequest 
method in my ComponentEventLinkEncoder. Could someone please point me in the 
right direction to both:

- Generate an arbitrary URL for an event (this part is working).
- Have tapestry recognize the 'click' of that same arbitrary URL as an event, 
so I can route it to my event handler method (not yet working).

Thanks,
Mike

Reply via email to