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

Unversioned pages don't get touched when created and cannot be found by ID later

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5.4
    • 1.5.5, 6.0.0-beta1
    • wicket
    • Windows 7 64-bit
      JDK 1.6.0_29 64-bit
      Jetty 6.1.16 / WebSphere 7

    Description

      When I tell Wicket not to version pages by default via IPageSettings#setVersionPagesByDefault(false), created pages cannot be found later by theirs ID. Versioned pages are touched upon creation in dirty(boolean) method and thus stored in the page store. But unversioned ones are not! So when I create a Page, wrap it inside a PageProvider and RenderPageRequestHandler, then get its URL with urlFor, the URL is useless, because the page is referenced by its ID in the URL but it cannot be found by that URL later.
      I'll give you an simple example.

      PAGE 1:
      public class WicketMainPage extends WebPage {
      public WicketMainPage()

      { PopupPage page = new PopupPage("Created: " + new Date()); // getSession().getPageManager().touchPage(page); PageProvider pp = new PageProvider(page); RenderPageRequestHandler rh = new RenderPageRequestHandler(pp); add(new Label("url", urlFor(rh).toString())); }


      }
      as you can see, I only create an instance of second page (which is not
      bookmarkable as it has some parameters), wrap it in page provider and request
      handler and simply output URL for it (of course it is an stateful URL).

      The second page is just simple outputting text from constructor
      PAGE 2:
      public class PopupPage extends WebPage {
      public PopupPage(String text)

      { add(new Label("text", text)); }


      }

      When I run this, the app outputs an relative part of URL to the second page...
      if I copy this into browser, everything works, when pages are versioned. But
      when I set setVersionPagesByDefault(false) I start to get PageExpiredException
      whe trying to access the second page. When I uncomment the touchPage line,
      everythings works even with unversiones paged.

      I think, that instead of explicitly touching the page, it should be done by
      Wicket when retrieving the url for it. Somewhere in mapUrlFor or mapHandler,
      etc... Or maybe it should be touched in the dirty method just like versioned pages.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            davesman David Rain
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: