[ 
https://issues.apache.org/jira/browse/WICKET-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martijn Dashorst updated WICKET-117:
------------------------------------

    Fix Version/s: 1.2.7

> Page expired using ajax
> -----------------------
>
>                 Key: WICKET-117
>                 URL: https://issues.apache.org/jira/browse/WICKET-117
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.2, 1.2.3, 1.2.6
>            Reporter: Adam Smyczek
>            Assignee: Johan Compagner
>             Fix For: 1.2.7
>
>
> We are still getting page expired using wicket with ajax. The problem is 
> related to the PageMap and occurs as following:
> 1. We have a page with an ajax time behavior that updates a status every 2 
> sec. This page is the most top one on the page map stack. 
> 2. On this page you click the link to go to another page. The new page is 
> added to the page stack but the response is expensive, let's say it take 1-2 
> sec. to build the page.
> 3. During the response is processed, the browser triggers the ajax request, 
> to the server. The request goes to the PageMap to get the current page.
> The page of the ajax request is the second top one on the stack, so the 
> current code assumes the user clicked the back button and removes the 
> top one page.
> 4. In the browser everything seams to be ok, but the page in the browser and 
> in the PageMap don't match anymore. So any new request to the server will 
> cause page expired.
> This is very simple to reproduce, following is a snippet for the quickstart:
> --- Index.java ---
> public class Index extends QuickStartPage
> {
>       public Index(final PageParameters parameters)
>       {
>               // link to the same page
>               Link link = new Link("link")
>               {
>                       public void onClick()
>                       {
>                               setResponsePage(Index.class);
>                       }
>               };
>               add(link);
>               // we just need a delayed call to the server
>               AjaxEventBehavior behavrior = new AjaxEventBehavior("onClick")
>               {
>                       protected void onEvent(AjaxRequestTarget target)
>                       {
>                       }
>               };
>               behavrior.setThrottleDelay(Duration.milliseconds(200));
>               link.add(behavrior);
>       }
>       protected void onAfterRender()
>       {
>               // simulate expensive response
>               try
>               {
>                       Thread.sleep(500);
>               }
>               catch (InterruptedException e)
>               {
>                       e.printStackTrace();
>               }
>       }
> }
> --- Index.html ---
> <html>
>     <body>
>       <a wicket:id="link">Click</a>
>     </body>
> </html>
> I used Firefox only to reproduce it, not sure if this occurs with other 
> browser as well.
> We have a small workaround('fix') for it. In 
> DefaultRequestTargetResolverStrategy we check the type of the request. If it 
> is a IUnversionedBehaviorListener, we don't update the PageMap in the 
> access() method. It is not a clean solution but it works so far.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to