Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-117

Page expired using ajax

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.2.2, 1.2.3, 1.2.6
    • 1.2.7
    • wicket
    • None

    Description

      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.

      Attachments

        Activity

          People

            jcompagner Johan Compagner
            smitti Adam Smyczek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: