Hi,
another option is to manage the Timeout in Javascript
on each render of the layout component Yout pass to a Javascript
function the maxInactiveInterval of the session and on Javascript side
starts an Timer with count down function. When the maxInactiveInterval
value is 0, a window.location.href = "/timeout"; is called.

Javascript module:
(function() {
    define ([] , function() {
        var exports, timeout, tick, init;
        var remaining = 0;
        var timer;

        timeout = function() {
            window.location.href = "/timeout";
        };

        tick = function() {
            remaining = Number(remaining);

            remaining = remaining - 1;
            if (remaining <= 0) {
                window.clearInterval(timer);
                timeout();
            };
        };

        init = function(timeoutInterval){
            remaining = timeoutInterval;
            timer = window.setInterval(tick, 1000);
         };

        return exports = {
            init : init
        };

    });
}).call(this);

Layout component:
    @AfterRender
    void afterRender() {
        Session session = request.getSession(false);
        if (session != null) {
            
javaScriptSupport.require("SessionInfo").invoke("init").with(session.getMaxInactiveInterval());
        }
    }

2013/9/18 Michael Gagauz <gagau...@gmail.com>:
> Another options to return from page/component event:
> 1. Link object
> 2. String with page url
> 3. JSON containing {redirectURL:"/desired/location"}
>
>
> 18.09.2013 16:22, ANDRE Christophe пишет:
>>
>> Hi,
>>
>>
>> I have an application that use a lot of Ajax.
>> When my session has expired, my server redirect me on my deconnexion page.
>> (Spring web do it)
>> The problem is if I get redirected after an Ajax call, nothing happens. (I
>> guess the client wait for an ajax answer and not for a redirection)
>>
>> How could I solve this?
>>
>> Thx,
>>
>> Christophe
>>
>> Ce message et toutes les pieces jointes (ci apres le message) sont etablis
>> a l intention exclusive de leurs destinataires.
>> Si vous recevez ce message par erreur, merci de le detruire et d en
>> avertir immediatement l expediteur par e mail.
>> Toute utilisation de ce message non conforme a sa destination, toute
>> diffusion ou toute publication, totale ou partielle, est interdite, sauf
>> autorisation expresse de l expediteur.
>> Les communications sur Internet n etant pas securisees, DOCAPOST BPO
>> informe qu elle ne peut accepter aucune responsabilite quant au contenu de
>> ce message.
>>
>
> ---------------------------------------------------------------------
> 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