views:

46

answers:

2

Hi everybody,

How can I handle a session-timeout when doing an ajax request with wicket?

Currently (e.g. using an AbstractAjaxTimerBehavior) the user is redirected to the session expired page. I would like to handle this on the client side using javascript (for a better user experience).

Overriding onException (doing nothing) and getFailureScript are working well if another error occurs on the server side or the server does not respond at all. But not if the server responds and the user's wicket session is expired.

Any suggestions are very much appreciated, thanks a lot.

Peter

+1  A: 

I have found an ugly workaround for this, the wicket devs obviously do not see demand to handle ajax session expiration on the client side.

Have a look at the solution here: https://issues.apache.org/jira/browse/WICKET-3081

PeterP
Yup, that's all I could've come up with too, I'm afraid. The only thing else you can do is to prevent the timeout in the first place my having a component on your page that regularly updates itself (but that's a bit ugly).
seanizer
A: 

The session expired page usually appears when your pages are not bookmarkable and you make a request for a page to the server but the server has a different version of the page that you have requested. It shouldn't have anything to do with the session time out which is defined in the web.xml file.

As a good practice, your pages should have a constructor with PageParameters. Also be careful with the popup pages because they usually generate these kind of errors when they are not using PageParameters.

virgium03
We're having PageParameters and all this stuff. But if there's any component depending on the page state, e.g. an ajax component, the user will be redirected to the SessionExpiredPage when an ajax request goes out after the session has timed out.
PeterP
check your web.xml for the session timeout configuration
virgium03