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

                 Key: WICKET-4420
                 URL: https://issues.apache.org/jira/browse/WICKET-4420
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.4
         Environment: Windows 7 64-bit
JDK 1.6.0_29 64-bit
Jetty 6.1.16 / WebSphere 7
            Reporter: David Rain
            Priority: Minor


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to