In case someone's interested... The solution was as simple as:
@Inject private ComponentEventLinkEncoder cele; (...) return cele.decodePageRenderRequest(request) != null && cele.decodeComponentEventRequest(request) == null; if that expression is true, then it's a fresh page request and it's safe to clean up the session state, which can be achieved by doing: componentResources.discardPersistentFieldChanges(); :) Cheerz Juan Isern wrote: > > Alfie, thanks. > > It seems that the isXHR() approach will be good enough but it's nice to > know of other mechanisms in the case the thing gets too complex. > > > Alfie Kirkpatrick wrote: >> >> There's been some discussion on this in the past. The easiest way if AJAX >> is your only scenario is probably using request.isXHR(). An alternative >> is to maybe use the ComponentEventLinkEncoder either directly or by >> intercepting it. It knows whether the request is for a page or component >> event. >> >> http://markmail.org/message/mug7wv5gueuw6hhj >> http://markmail.org/message/gds72nly2vk5sqm3 >> >> Hope it helps, >> Alfie. >> >> -----Original Message----- >> From: Juan Isern [mailto:juanis...@gmail.com] >> Sent: 14 April 2010 21:01 >> To: users@tapestry.apache.org >> Subject: Good practices for handling page cleanup >> >> >> Guys, I've been working with some ajax components that need, to work >> properly, to store data in the session as persistent fields. >> >> I thought onActivate() would be a nice place to clean things up, doing it >> at >> the very first moment that a page is requested by the user seems ok. >> >> The problem is that onActivate() gets invoked during ajax requests too. >> >> Is it any way to determine when a request comes from a user that's >> entered >> an address or followed a link to that page, and make sure that request >> does >> not come from ajax or an action link on it? I think that'd be my >> requirement >> >> Thanks again, Juan >> -- >> View this message in context: >> http://old.nabble.com/Good-practices-for-handling-page-cleanup-tp28247499p28247499.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 >> >> >> > > -- View this message in context: http://old.nabble.com/Good-practices-for-handling-page-cleanup-tp28247499p28287213.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