Class DiskPageStore
- java.lang.Object
-
- org.apache.wicket.pageStore.AbstractPersistentPageStore
-
- org.apache.wicket.pageStore.DiskPageStore
-
- All Implemented Interfaces:
IPageStore,IPersistentPageStore
public class DiskPageStore extends AbstractPersistentPageStore implements IPersistentPageStore
A storage of pages on disk.All pages passed into this store are restricted to be
SerializedPages.Implementation note:
DiskPageStorewrites pages into a single file, appending new pages while overwriting the oldest pages. Since Ajax requests do not change the id of a page,DiskPageStoreoffers an optimization to overwrite the most recently written page, if it has the same id as a new page to write.However this does not help in case of alternating requests between multiple browser windows: In this case requests are processed for different page ids and the oldests pages are constantly overwritten (this can easily happen with Ajax timers on one or more pages). This leads to pages with identical id superfluously kept in the file, while older pages are prematurely expelled. Any following request to these older pages will then fail with
PageExpiredException.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDiskPageStore.DiskDataData held on disk.-
Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
-
Constructor Summary
Constructors Constructor Description DiskPageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession)Create a store that supportsSerializedPages only.DiskPageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession, ISerializer serializer)Create a store to disk.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPersistedPage(java.lang.String sessionIdentifier, IManageablePage page)Add a page.voiddestroy()Destroy the store.protected DiskPageStore.DiskDatagetDiskData(java.lang.String sessionIdentifier, boolean create)Get the data on disk for the given session identifier.protected IManageablePagegetPersistedPage(java.lang.String sessionIdentifier, int id)java.util.List<IPersistedPage>getPersistedPages(java.lang.String sessionIdentifier)Get information about all persisted pages with the given session identifier.java.util.Set<java.lang.String>getSessionIdentifiers()Get the identifiers for all stored sessions.org.apache.wicket.util.lang.BytesgetTotalSize()Get total size of all pages stored in all contexts.protected voidremoveAllPersistedPages(java.lang.String sessionIdentifier)protected voidremovePersistedPage(java.lang.String sessionIdentifier, IManageablePage page)booleansupportsVersioning()Pages are already serialized.-
Methods inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
addPage, canBeAsynchronous, createSessionIdentifier, getPage, getSessionIdentifier, removeAllPages, removePage
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.pageStore.IPageStore
addPage, canBeAsynchronous, detach, getPage, removeAllPages, removePage
-
Methods inherited from interface org.apache.wicket.pageStore.IPersistentPageStore
getSessionIdentifier
-
-
-
-
Constructor Detail
-
DiskPageStore
public DiskPageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession)Create a store that supportsSerializedPages only.- Parameters:
applicationName- name of applicationfileStoreFolder- folder to store tomaxSizePerSession- maximum size per session- See Also:
SerializingPageStore
-
DiskPageStore
public DiskPageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession, ISerializer serializer)Create a store to disk.- Parameters:
applicationName- name of applicationfileStoreFolder- folder to store tomaxSizePerSession- maximum size per sessionserializer- for serialization of pages
-
-
Method Detail
-
supportsVersioning
public boolean supportsVersioning()
Pages are already serialized.- Specified by:
supportsVersioningin interfaceIPageStore
-
destroy
public void destroy()
Description copied from interface:IPageStoreDestroy the store.- Specified by:
destroyin interfaceIPageStore- Overrides:
destroyin classAbstractPersistentPageStore
-
getPersistedPage
protected IManageablePage getPersistedPage(java.lang.String sessionIdentifier, int id)
- Specified by:
getPersistedPagein classAbstractPersistentPageStore
-
removePersistedPage
protected void removePersistedPage(java.lang.String sessionIdentifier, IManageablePage page)- Specified by:
removePersistedPagein classAbstractPersistentPageStore
-
removeAllPersistedPages
protected void removeAllPersistedPages(java.lang.String sessionIdentifier)
- Specified by:
removeAllPersistedPagesin classAbstractPersistentPageStore
-
addPersistedPage
protected void addPersistedPage(java.lang.String sessionIdentifier, IManageablePage page)Description copied from class:AbstractPersistentPageStoreAdd a page.- Specified by:
addPersistedPagein classAbstractPersistentPageStore- Parameters:
sessionIdentifier- identifier of sessionpage- page to add
-
getDiskData
protected DiskPageStore.DiskData getDiskData(java.lang.String sessionIdentifier, boolean create)
Get the data on disk for the given session identifier.- Parameters:
sessionIdentifier- identifier of session- Returns:
- matching data
-
getSessionIdentifiers
public java.util.Set<java.lang.String> getSessionIdentifiers()
Description copied from interface:IPersistentPageStoreGet the identifiers for all stored sessions.- Specified by:
getSessionIdentifiersin interfaceIPersistentPageStore- Returns:
- the identifiers of all session.
-
getPersistedPages
public java.util.List<IPersistedPage> getPersistedPages(java.lang.String sessionIdentifier)
Description copied from interface:IPersistentPageStoreGet information about all persisted pages with the given session identifier.- Specified by:
getPersistedPagesin interfaceIPersistentPageStore- Parameters:
session- key- Returns:
- a list of the last N page windows
-
getTotalSize
public org.apache.wicket.util.lang.Bytes getTotalSize()
Description copied from interface:IPersistentPageStoreGet total size of all pages stored in all contexts.Optional operation, may return
null.- Specified by:
getTotalSizein interfaceIPersistentPageStore- Returns:
- total size or
null
-
-