Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Note
title"Page map" concept was discarded in Wicket 1.5 and is no longer part of the future releases.

Note
title"Page" in this text means stateful page. Page maps do not store [stateless pages]. "Page map" means IPageMap interface and its implementations.

...

Page map is a part of Session. Basically it is used as an interface for storing pages and their versions. Page map stores instances of pages (including component tree) which were visited by user during the current session. So every time user goes to another page or changes page state, the page instance is stored in a page map. There can be one or more page maps in one http session where each page map corresponds to a browser tab (or a modal window if it contains a page and has had a separate page map set). Page maps are identified by their names.

In a sense, page maps can be viewed as an implementation detail of Session, since they are used only through IPageMap interface and some of their the functionality should be accessed only through Session.

...

Code Block
class MyHomePage extends WebPage {

    public MyHomePage() {
        add(new Link("changeState", new Model()) {
            public void onClick() {
                // this changes link state and therefore page state
                this.setModelObject(new Random().nextInt());
            }
        });

        add(new Link("gotoNewPage") {
            public void onClick() {
                setResponsePage(new MyPageMyHomePage());
            }
        });
    }
}

Now if you go to home page, click once on "gotoNewPage" link, twice on "changeState" link and twice on "gotoNewPage" link again, the page map for the current session will look like this (it doesn't mean page map stores pages in a table or map):

...

The first instance of home page with id 0 and version 0 was created when you went to application home page (i.e. typed in browser a URL like http://localhost:8080/appImage Removed). Then after clicking on "gotoNewPage" link, page with id 1 and version 0 was created and added to the page map. Next two clicks on "changeState" link added to the page map versions 1 and 2 of the home page. And finally two clicks on "gotoNewPage" link created and added another two home page instances to the page map.

...

So for example to access second version of page instance with id 1 the following URL will be used: http://localhost:8080/app/?wicket:interface=:1:2:::Image Removed. If there is no page with specified id and version, then "Page Expired" page will be shown.

Similarly components like Links and Buttons, which provide callback to user code, use URLs which point to the page instance in a page map. For example "changeState " link on the second version of page with id 1 will have URL like this http://localhost:8080/app/?wicket:interface=:1:changeState:2:ILinkListener::Image Removed When this link is clicked Wicket will call onClick() handler for this link on the page instance with id 1 and version 2.

...

  • on opening tab in web-browser (see IPageSettings#getAutomaticMultiWindowSupport())
  • on creating modal/popup window
  • when using inline frames
  • anywhere in code using PageMap#forName() method
  • it's not normal usecase, but page map is also created whenever a URL is requested which contains name of not-existing page map. For example URL like http://localhost:8080/app/?wicket:interface=newPageMap:0::::Image Removed will create page map with name "newPageMap".

...