开发者

How to handle session timeout with wicket ajax requests?

开发者 https://www.devze.com 2023-01-17 22:49 出处:网络
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 hand

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 hand开发者_运维问答le 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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消