AjaxSelfUpdatingBehavior problem with HttpSessionStore
------------------------------------------------------
Key: WICKET-1971
URL: https://issues.apache.org/jira/browse/WICKET-1971
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.5
Reporter: Mikko Pukki
Issue is discussed at:
http://www.nabble.com/AjaxSelfUpdatingBehavior-problem-with-HttpSessionStore-to20841818.html#a20842209
We discovered a problem when using AjaxSelfUpdatingbehavior combined
with ajax buttons (when ajax button forwards to another page (let's call is
PageB) by
setResponsePage method).
When a user hits a button and immediately after that an ajax request is fired
by the
AjaxSelfUpdatingbehavior, AccessStackPageMap thinks that user has pressed back
button.
This is what happens when this behavior occurs:
1) User pressed an ajax button
2) AjaxSelUpdatingBehavior fires another ajax request right after user pressed
button
3) User ends up on PageB
4) now pressing ajax buttons on a new page has no effect
WebRequestCycleProcessor's resolve method goes now to line 114:
if (pageId != access.getId())
{
// the page is no longer the active page
// - ignore this request
processRequest = false;
}
Wicket Ajax Debug prints something like this:
INFO: Initiating Ajax POST request on ?
wicket:interface=:1:inputForm:back::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&random=0.6741350924814413
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (31 characters)
INFO:
<ajax-response></ajax-response>
ERROR: Error while parsing response: Could not find root <ajax-response>
element
INFO: Invoking post-call handler(s)...
We debugged around a bit and discovered that when this behavior happens,
AccessStackPageMap's
accept method is called with instance of PageB as entry parameter. But
instantly after that a request
that came from AjaxSelfUpdatingBehavior calls also AccessStackPageMap's
accept method (entry is now the page where AjaxSelfUpdatingBehavior was added).
Now reference
of PageB is removed from stack and AccessStackPagemap thinks that user is on
previous page while user
is really on PageB.
I made simplest possible quickstart application that behaves like this. I put
an AjaxSelfUpdatingBehavior to
update a component on a page at 2 second intervals. Then I added an Ajax link
and in its onSubmit method I
put thread to sleep for 3 seconds before setResponsePage is called. That way
this behavior can be repeated
always when pressing the button. If the sleep is removed then of course this
happens rarely, but in our real
life application it shows up very frequently.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.