Hi Jonathan, Thanks for your input so far.
I have managed to solve the problem by borrowing some code from ComponentEventDispatcher and PageRenderDispatcher. The beast of a regexp in ComponentEventDispatcher provides a means to get the 'activePageName' but this includes the context as well. There is code in the PageRenderDispatcher to strip out the context which leaves you with the page name. With the page name you can get the page class by injecting ComponentSource and passing the page name to the getPage(pageName) method. Also if you follow the wiki tutorial it tells you to place your dispatcher before the PageRender stage. To intercept event links, you must place it before the ComponentEvent stage otherwise event links will be eaten by the ComponentEventDispatcher before they reach your code. Daniel Jonathan O'Connor-3 wrote: > > Thiago, > I thought about the service idea, but what would it look like? > Class extractPageClass(String requestPath) would be what I'd want. > > However, for each Dispatcher, you'd want a PageClassExtracter as well, > and I'm sure there'd be lots of duplication. To stay DRY, I guess we > have to add the extractPageClass method to the Dispatcher interface, > which is not very nice, especially as the AssetDispatcher does not use > pages. Maybe we could extend Dispatcher to UsesPagesDispatcher that has > our method. Now, we can iterate through the Dispatcher pipeline, and > call extractPageClass only on the UsesPagesDispatchers. > > Does that all make sense? Or is there a better way? > Ciao, > Jonathan > > On 05/02/2009 18:59, Thiago H. de Paula Figueiredo wrote: >> Em Thu, 05 Feb 2009 07:40:24 -0300, Jonathan O'Connor >> <ninki...@eircom.net> escreveu: >> >>> Daniel, >>> I was looking at this problem the other day, and you should look at >>> the ComponentEventDispatcher. I think you need to first check if you >>> get a matching page, and then check if you have an event. You can >>> then extract the Pagename from the request path using that monster >>> Reg exp. Sadly, this all relies on internal code :-( >> >> I have the same need of extracting the page name from a Request. >> Should we file a JIRA to have a public service that does that? >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/Protecting-ActionLinks-when-using-a-Dispatcher.-tp21848757p21858880.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org