The FlowLogix library ( http://code.google.com/p/flowlogix/ ) has components to deal with the session timeout issues and Ajax.
Take a look at these in particular: http://code.google.com/p/flowlogix/wiki/TLAJAXAnnotation http://code.google.com/p/flowlogix/wiki/TLSessionMonitor On Feb 5, 2013, at 6:28 AM, sommeralex <alexander.som...@gmail.com> wrote: > Hello! > > Is there a good "best practise" in tapestry/ (or webframeworks at all) for > keeping a session for a page alive OR handling session timeouts? Is keeping > a session alive an anti-pattern? > > I have two pages where some errors occur, if the user wants to do something > but the session is over. Both pages use javascript and have a callback to > the tapestry page via ajax. > > e.g. user wants to slide a slider, on slide end: > new Ajax.Request(urlSetGroupPositionAndSize, { onSuccess: updatePage, > parameters: 'lat='+ lat + '&lng=' + lon + '&scopeRadius=' + > Math.floor(scopeRadius)}); > > but, if the session is over, i get various javascript/tapestry errors on top > of my page - I cant copy them because the error message appears "behind" my > page and it disappears after some seconds. But i could make a screenshot: > > http://www.learnclip.com/tapestry/bugs/timeout.png > > > what i have found so far: > > http://mail-archives.apache.org/mod_mbox/tapestry-users/200504.mbox/%3c20050407181906.ga9...@jetpen.com%3E > > which mentions to use httpSession.setMaxInactiveInterval or > http://comments.gmane.org/gmane.comp.java.tapestry.user/55982 > > which says there could be a trick to set the timeout to 0 / which is not > recommended or to use javascript with a period updater / which is also not > recommended. > > *so, keeping the session alive is not the way*. right? > > BUT > > then I would need a "service", which is checking the session validity. > (http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Session.html#isInvalidated()) > > *would it be enough/ok to make JUST this on my java method* (which is called > from Javascript)? > > public void onSetGroupPosAndSize(){ > > if (session.isInvalidated(){ > > //return LoginPage.class; > > }else { > > //go on > > } > > > > > > > } > > > > > > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Keeping-the-session-alive-pattern-tp5719771.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 >