Wicket
  1. Wicket
  2. WICKET-4420

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.4
    • Fix Version/s: 1.5.5, 6.0.0-beta1
    • Component/s: wicket
    • Environment:
      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.

        Activity

        David Rain created issue -
        Martin Grigorov made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 1.5.5 [ 12319052 ]
        Fix Version/s 6.0.0 [ 12315431 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            David Rain
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development