You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Colin Rogers <Co...@objectconsulting.com.au> on 2015/01/23 02:35:41 UTC

Handling stale Ajax Requests

Wicketeers,

I have an issue to resolve and I hope someone can help.

The user opens a link from 'Window 1' to open in new tab ('Window 2') and goes off and does a whole bunch of stuff in Window 2. After following a few links, the user returns to 'Window 1' and triggers an Ajax link. By now this page isn't in the page cache or whatever (at least I assume) and the Ajax link fails.

Currently the behaviour is simply to forward to a brand new version of the page (i.e. the base of URL). Which is odd behaviour for the user, as all their state simply disappears. What I'd like to do is forward to the home page with a 'this page or link has expired' or similar so the difference isn't jarring, unfortunately I have no way to trap when this happens. No Exception is triggered in the IRequestCycleListener - I'd have expected a StalePageException or PageExpiredException, or similar but no exception is triggered here.

Is there a way to handle this stale ajax request elegantly?

Cheers,
Col.
EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses.

Re: Handling stale Ajax Requests

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

>From the description I'd bet it is PageStaleException. You can verify that
by putting a breakpoint at PageProvider#resolvePageInstance().
Your IRequestCycleListener#onException() should be notified. No idea why
this doesn't happen.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Jan 23, 2015 at 3:35 AM, Colin Rogers <
Colin.Rogers@objectconsulting.com.au> wrote:

> Wicketeers,
>
> I have an issue to resolve and I hope someone can help.
>
> The user opens a link from 'Window 1' to open in new tab ('Window 2') and
> goes off and does a whole bunch of stuff in Window 2. After following a few
> links, the user returns to 'Window 1' and triggers an Ajax link. By now
> this page isn't in the page cache or whatever (at least I assume) and the
> Ajax link fails.
>
> Currently the behaviour is simply to forward to a brand new version of the
> page (i.e. the base of URL). Which is odd behaviour for the user, as all
> their state simply disappears. What I'd like to do is forward to the home
> page with a 'this page or link has expired' or similar so the difference
> isn't jarring, unfortunately I have no way to trap when this happens. No
> Exception is triggered in the IRequestCycleListener - I'd have expected a
> StalePageException or PageExpiredException, or similar but no exception is
> triggered here.
>
> Is there a way to handle this stale ajax request elegantly?
>
> Cheers,
> Col.
> EMAIL DISCLAIMER This email message and its attachments are confidential
> and may also contain copyright or privileged material. If you are not the
> intended recipient, you may not forward the email or disclose or use the
> information contained in it. If you have received this email message in
> error, please advise the sender immediately by replying to this email and
> delete the message and any associated attachments. Any views, opinions,
> conclusions, advice or statements expressed in this email message are those
> of the individual sender and should not be relied upon as the considered
> view, opinion, conclusions, advice or statement of this company except
> where the sender expressly, and with authority, states them to be the
> considered view, opinion, conclusions, advice or statement of this company.
> Every care is taken but we recommend that you scan any attachments for
> viruses.
>