The way I got around this was by sticking all ajax stuff in a separate controller hierarchy that would return special content based on the request and whether or not the session lived. for json it'd just return a specific flag in the object it'd throw out (which was parsed by a global callback before calling my user defined stuff) that'd gracefully error the request for that, and any text/html would just output a script that'd toss up a dialog that said the session expired, and that the user should log in again.

Clunky, but it works, sort of.

Bill Moseley wrote:


On Thu, Mar 4, 2010 at 7:05 AM, Peter Karman <pe...@peknet.com <mailto:pe...@peknet.com>> wrote:


    // make sure we are logged in before every xhr request
    Ext.Ajax.on('beforerequest', function(conn, opts) {
       if (!AIR.Auth.isAuthenticated()) {
           AIR.Auth.login();
           return false;
       }
       return true;
    });


I thought about this, but in our case the ajax was checking for a specific session because the server-side session had state info need for the ajax request. So, just allowing the user to log in again was not possible.

That's probably bad design on top of bad design. In our case probably better to rethink then entire process and just make request that can be independent and either work or fail in some graceful way. making assumptions about expected state is problem the root cause.

--
Bill Moseley
mose...@hank.org <mailto:mose...@hank.org>
------------------------------------------------------------------------

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

--
Ben van Staveren
phone: +62 81 70777529
email: benvanstave...@gmail.com

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to