PDA

View Full Version : Session timeout handling..



praveen_pkc
25 Apr 2012, 1:16 AM
Need to perform a redirect to log in page in case there a session time out.

I am doing it this way.

Ext.Ajax.on('requestexception', function (conn, response, options) {
if(response.status == 401){
delete options.failure;
delete options.callback;
Ext.MessageBox.alert(alert_window, timeoutmessage, function(btn){
window.location = baseUrl;
});
}else {
return true;
}
});

So this means all ajax request exceptions will be handled here itself.

Now I have a ajax proxy which has listener for exception event, here I do some clean up and displaying response text.

Wanted to understand the difference between "requestexception" and "exception" ?

Also, is there something like an interceptor which intercepts the requestexception to check for 401 and then executes function associated with exception listener for ajax proxy ?

mitchellsimoens
1 May 2012, 7:02 AM
requestexception will only fire if the request was not successful. exception will fire if something happened like data was read correctly or configs weren't set correctly.