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 maps
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. Page maps are identified by their names.
...
Page maps are created by ISessionStores. There are two ISessionStore implementations bundled with Wicket, each of them create different page map implementations. HttpSessionStore creates AccessStackPageMap; SecondLevelCacheSessionStore (this is default in Wicket 1.3) creates SecondLevelCachePageMap.
Panel |
---|
bgColor | #FFFFFF |
---|
borderStyle | dashed |
---|
|
Image Modified
|
From the API point of view there are several ways to create page map. The wrong way is to obtain ISessionStore instance (for example through Application#getSessionStore()) and ask it to create page map. It's shouldn't be done this way since all page map creation is "encapsulated" in Session class. There are several methods in Session for creating/getting a page map:
- pageMapForName(name, autoCreate),
- newPageMap(name)
- createAutoPageMap() (see WebPage#onNewBrowserWindow() method)
There is also convenient static method in PageMap class PageMap#forName(pageMapName) which simply calls pageMapForName(name, autoCreate) with autoCreate parameter set to true. Probably the most common way to create/obtain page map in code, if you need one, is to do something like PageMap.forName("myPageMapName").
Panel |
---|
bgColor | #FFFFFF |
---|
borderStyle | dashed |
---|
|
Image Modified
|
In this diagram Session#pageMapForName() first tries to get page map from ISessionStore and if the attempt fails, creates new one and puts it into the ISessionStore.
...
There is no methods in Session for removing pages from page map. Pages may be removed from page map when the page map which contains them is removed. In other cases removing pages from page map is responsibility of ISessionStore (for example HttpSessionStore use LeastRecentlyAccessedEvictionStrategy).
Panel |
---|
bgColor | #FFFFFF |
---|
borderStyle | dashed |
---|
|
Image Modified
|
This is simplification since PageMap don't use ISessionStore directly.
...