[ https://issues.apache.org/jira/browse/WICKET-3081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915338#action_12915338 ]
Peter Parson commented on WICKET-3081: -------------------------------------- Thanks for your response, Igor. In my case, a session expired *message* makes very much more sense than a page redirect. As I am using a timer behavior, the user would be redirected to an error page all of a sudden, without interaction, which is not at all user friendly. Instead I'd rather handle the error on the client side, allowing the user to copy-paste whatever might just have been doing. Basically, I think that it should be able to handle every ajax response or error using javascript, even if the session and the page are gone. I've managed to find a workaround, which seems a bit ugly to me (but still seems to work fine) - in case anyone with the same needs stumbles across this issue: override newRequestCycleProcessor in your Application, and define window.handleAjaxSessionTimeout() somewhere in your javascript. (This might be abusing wicket concepts, but works for me - use on your own risk ;-) @Override protected IRequestCycleProcessor newRequestCycleProcessor() { return new WebRequestCycleProcessor() { @Override public void respond(RuntimeException e, RequestCycle requestCycle) { if (e instanceof PageExpiredException) { if(((WebRequest)RequestCycle.get().getRequest()).isAjax()) { AjaxRequestTarget rt = new AjaxRequestTarget(RequestCycle.get().getRequest().getPage()); rt.appendJavascript("if(typeof window.handleAjaxSessionTimeout=='function')window.handleAjaxSessionTimeout()"); RequestCycle.get().setRequestTarget(rt); return; } } super.respond(e, requestCycle); } }; } > AJAX call to timed-out session should result in failureScript rather than > redirect to SessionExpiredPage > -------------------------------------------------------------------------------------------------------- > > Key: WICKET-3081 > URL: https://issues.apache.org/jira/browse/WICKET-3081 > Project: Wicket > Issue Type: Bug > Components: wicket > Environment: Wicket 1.3.7 > Reporter: Peter Parson > Assignee: Igor Vaynberg > > Currently, it does not seem to be possible to react in a user-friendly manner > if an AJAX request detects that its session has timed out. > I suggest that a valid AJAX response should be returned, invoking the > failureScript (if there is one, otherwise SessionExpiredPage is a valid > response) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.