Reputation: 523
I'm trying to fix unresponsive UI after session times out. Ajax requests fail because of HTTP 302 redirect to login page - ajax error is Could not find root <ajax-response> element
.
I've subscribed to ajax failure event:
Wicket.Event.subscribe('/ajax/call/failure', function( attrs, jqXHR, textStatus, jqEvent, errorThrown ) {
handleAjaxCallFailure(attrs, jqXHR, textStatus, jqEvent, errorThrown);
});
But I can't find any reasonable way to obtain http response, response code or other http headers. I've also tried:
$(document).ajaxError(function (event, jqXHR, ajaxSettings, thrownError) {
handleAjaxError(event, jqXHR, ajaxSettings, thrownError);
});
But this is not firing at all. I'm using apache wicket 7.6.0. Is there any other way to force user to login page?
Upvotes: 1
Views: 422
Reputation: 17513
There must be some error on the line.
Usually Wicket will return a proper Ajax response (the XML) with a single element in <redirect>../the/path/to/login</redirect>
and wicket-ajax-jquery.js will process it and make the redirect.
In addition there might be a response header named Ajax-Location
which Wicket handles the same way.
Check the response headers and body. Paste them here too!
Upvotes: 1