I have a somewhat generic method of redirection to the same page, forcing a 
login in
the flowlogix module ( http://code.google.com/p/flowlogix/ )
It works automatically with Tynamo security.

On Dec 1, 2011, at 8:47 AM, Peter Stavrinides wrote:

> Sorry my trigger finger sent it before I finished typing:
> 
> //Server side I do this
> JSONObject json = new JSONObject();
> json.put("redirect", getRefreshLink().toAbsoluteURI());
> return json
> 
> client side this:
> // The method that is called when the request completes
> onComplete : function(transport) {
> ...
> var redirect = (reply.redirect != undefined);
> if(redirect)
> location.href=reply.redirect;
> }
> 
> You can configure this any way you chose, page or via a dispatcher, basically 
> anywhere you have a request object. Only thing is you will need to bind the 
> handler for the js.
> 
> Cheers,
> Peter
> 
> 
> 
> ----- Original Message -----
> 
> From: "Peter Stavrinides" <p.stavrini...@albourne.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Sent: Thursday, 1 December, 2011 3:44:56 PM
> Subject: Re: Tapestry 5 JQuery - redirect to other page when session has 
> expired
> 
> 
> Server side:
> 
> // The method that is called when the request completes
> onComplete : function(transport) {
> ...
> var redirect = (reply.redirect != undefined);
> if(redirect)
> location.href=reply.redirect;
> }
> ----- Original Message -----
> 
> From: "François Facon" <francois.fa...@atos.net>
> To: "Tapestry users" <users@tapestry.apache.org>
> Sent: Thursday, 1 December, 2011 3:06:38 PM
> Subject: Re: Tapestry 5 JQuery - redirect to other page when session has 
> expired
> 
> Hi Ville,
> 
> Did you try to use Tynamo-security or to 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;
> }
> 
> as suggested in
> http://tapestry.1045711.n5.nabble.com/redirecting-from-an-ajax-event-listener-td2438259.html
> 
> François
> 
> 2011/12/1 Ville <ville.virta...@cerion.fi>:
>> Hi,
>> 
>> I googled around a bit, and have some thoughts how this could be done, but
>> what are the options? We're using Tap5-JQuery library.
>> 
>> The workaround I have currently in mind involves adding filter to serverside
>> that catches redirects to login page and if request is xhr then a json
>> response is generated instead. This involves wrapping the response etc.
>> 
>> I also have to intercept the call in browser side to have it working
>> correctly.
>> 
>> Is this the best way to do it?
>> 
>> - Ville
>> 
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/Tapestry-5-JQuery-redirect-to-other-page-when-session-has-expired-tp5038408p5038408.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
>> 
>> 
> 
> ---------------------------------------------------------------------
> 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

Reply via email to