- All Implemented Interfaces:
IPageStore
,IPersistentPageStore
All pages passed into this store are restricted to be SerializedPage
s.
Implementation note: DiskPageStore
writes pages into a single file, appending new pages while overwriting the oldest pages.
Since Ajax requests do not change the id of a page, DiskPageStore
offers 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 oldest 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
Modifier and TypeClassDescriptionprotected static class
Data held on disk.Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
Constructor Summary
ConstructorDescriptionDiskPageStore
(String applicationName, File fileStoreFolder, Bytes maxSizePerSession) Create a store that supportsSerializedPage
s only. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addPersistedPage
(String sessionIdentifier, IManageablePage page) Add a page.void
destroy()
Destroy the store.protected DiskPageStore.DiskData
getDiskData
(String sessionIdentifier, boolean create) Get the data on disk for the given session identifier.protected IManageablePage
getPersistedPage
(String sessionIdentifier, int id) getPersistedPages
(String sessionIdentifier) Get information about all persisted pages with the given session identifier.Get the identifiers for all stored sessions.Get total size of all pages stored in all contexts.protected void
removeAllPersistedPages
(String sessionIdentifier) protected void
removePersistedPage
(String sessionIdentifier, IManageablePage page) boolean
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, end, getPage, removeAllPages, removePage, revertPage
Methods inherited from interface org.apache.wicket.pageStore.IPersistentPageStore
getSessionIdentifier
-
Constructor Details
-
DiskPageStore
Create a store that supportsSerializedPage
s only.- Parameters:
applicationName
- name of applicationfileStoreFolder
- folder to store tomaxSizePerSession
- maximum size per session- See Also:
-
-
Method Details
-
supportsVersioning
Pages are already serialized.- Specified by:
supportsVersioning
in interfaceIPageStore
-
destroy
Description copied from interface:IPageStore
Destroy the store.- Specified by:
destroy
in interfaceIPageStore
- Overrides:
destroy
in classAbstractPersistentPageStore
-
getPersistedPage
- Specified by:
getPersistedPage
in classAbstractPersistentPageStore
-
removePersistedPage
- Specified by:
removePersistedPage
in classAbstractPersistentPageStore
-
removeAllPersistedPages
- Specified by:
removeAllPersistedPages
in classAbstractPersistentPageStore
-
addPersistedPage
Description copied from class:AbstractPersistentPageStore
Add a page.- Specified by:
addPersistedPage
in classAbstractPersistentPageStore
- Parameters:
sessionIdentifier
- identifier of sessionpage
- page to add
-
getDiskData
Get the data on disk for the given session identifier.- Parameters:
sessionIdentifier
- identifier of session- Returns:
- matching data
-
getSessionIdentifiers
Description copied from interface:IPersistentPageStore
Get the identifiers for all stored sessions.- Specified by:
getSessionIdentifiers
in interfaceIPersistentPageStore
- Returns:
- the identifiers of all session.
-
getPersistedPages
Description copied from interface:IPersistentPageStore
Get information about all persisted pages with the given session identifier.- Specified by:
getPersistedPages
in interfaceIPersistentPageStore
- Parameters:
sessionIdentifier
- key- Returns:
- a list of the last N page windows
-
getTotalSize
Description copied from interface:IPersistentPageStore
Get total size of all pages stored in all contexts.Optional operation, may return
null
.- Specified by:
getTotalSize
in interfaceIPersistentPageStore
- Returns:
- total size or
null
-