You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Parson (JIRA)" <ji...@apache.org> on 2010/09/27 13:11:33 UTC

[jira] Created: (WICKET-3081) AJAX call to timed-out session should result in failureScript rather than redirect to SessionExpiredPage

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


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.


[jira] Commented: (WICKET-3081) AJAX call to timed-out session should result in failureScript rather than redirect to SessionExpiredPage

Posted by "Peter Parson (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Resolved: (WICKET-3081) AJAX call to timed-out session should result in failureScript rather than redirect to SessionExpiredPage

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-3081?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3081.
-----------------------------------

      Assignee: Igor Vaynberg
    Resolution: Won't Fix

currently, in 1.4.x+ you will get a page expired error page. there is no point in invoking a failure script because the page will still be missing. page expired error page is the only valid response.

> 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.