As an alternative I think you contribute your own access control dispatcher:
AppModule.java . . . public void contributeMasterDispatcher( OrderedConfiguration<Dispatcher> configuration, @InjectService("AccessControlDispatcher") Dispatcher accessController) { configuration.add("AccessControlDispatcher", accessController, "before:ComponentEvent"); } ... and just have: . . . if (request.isXHR()) { boolean noSession = (request.getSession(false)) == null ? true : false; if (noSession){ OutputStream os = response.getOutputStream("application/json;charset=UTF-8"); os.write("{\"script\":\"window.location.reload();\"}".getBytes()); os.flush(); return true; } ... in its dispatch method, so the timeout scenario is checked when AJAX methods trigger a request, and redirect to your standard timeout page? This was a solution suggested previously on this list. Regards, Jim. -----Original Message----- From: Paul Stanton [mailto:p...@mapshed.com.au] Sent: 21 July 2010 08:12 To: Tapestry users Subject: Re: redirecting from an ajax event listener Thanks Kalle, The tynamo plugin does exactly what i need. regards, paul. Kalle Korhonen wrote: > You can implement onException() to catch exceptions thrown from page > event handlers (see > http://tapestry.apache.org/tapestry5.1/guide/event.html), or, though I > know you don't like this, for handling known exceptions in a more > generic manner you could use Tynamo's tapestry-exceptionpage module > (http://tynamo.org/tapestry-exceptionpage+guide) - the module handles > ajax requests as well. > > Kalle > > > On Tue, Jul 20, 2010 at 8:32 PM, Paul Stanton <p...@mapshed.com.au> wrote: > >> We have an ajax intensive project for which we need to better handle >> problems such as session timeouts. >> >> Most of our ajax event handlers will return a MultizoneUpdate, and currently >> will run into a NullPointerException if the session has timed out. >> >> Instead what I'd like these listeners to do is either forward to an error >> page (ie session timed out page) or attempt to reload the current page. >> >> I'd also prefer to not have to implement this for every listener, but >> utilise 'onActivate' so that I don't need to copy and paste code into every >> event listener. >> >> Does anyone have any tips for achieving this? >> >> p. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org