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
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
Nested Classes Modifier and Type Class Description protected static class
DiskPageStore.DiskData
Data held on disk.-
Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
-
Constructor Summary
Constructors Constructor Description DiskPageStore(String applicationName, File fileStoreFolder, Bytes maxSizePerSession)
Create a store that supportsSerializedPage
s only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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)
List<IPersistedPage>
getPersistedPages(String sessionIdentifier)
Get information about all persisted pages with the given session identifier.Set<String>
getSessionIdentifiers()
Get the identifiers for all stored sessions.Bytes
getTotalSize()
Get total size of all pages stored in all contexts.protected void
removeAllPersistedPages(String sessionIdentifier)
protected void
removePersistedPage(String sessionIdentifier, IManageablePage page)
boolean
supportsVersioning()
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 Detail
-
DiskPageStore
public DiskPageStore(String applicationName, File fileStoreFolder, Bytes maxSizePerSession)
Create a store that supportsSerializedPage
s only.- Parameters:
applicationName
- name of applicationfileStoreFolder
- folder to store tomaxSizePerSession
- maximum size per session- See Also:
SerializingPageStore
-
-
Method Detail
-
supportsVersioning
public boolean supportsVersioning()
Pages are already serialized.- Specified by:
supportsVersioning
in interfaceIPageStore
-
destroy
public void destroy()
Description copied from interface:IPageStore
Destroy the store.- Specified by:
destroy
in interfaceIPageStore
- Overrides:
destroy
in classAbstractPersistentPageStore
-
getPersistedPage
protected IManageablePage getPersistedPage(String sessionIdentifier, int id)
- Specified by:
getPersistedPage
in classAbstractPersistentPageStore
-
removePersistedPage
protected void removePersistedPage(String sessionIdentifier, IManageablePage page)
- Specified by:
removePersistedPage
in classAbstractPersistentPageStore
-
removeAllPersistedPages
protected void removeAllPersistedPages(String sessionIdentifier)
- Specified by:
removeAllPersistedPages
in classAbstractPersistentPageStore
-
addPersistedPage
protected void addPersistedPage(String sessionIdentifier, IManageablePage page)
Description copied from class:AbstractPersistentPageStore
Add a page.- Specified by:
addPersistedPage
in classAbstractPersistentPageStore
- Parameters:
sessionIdentifier
- identifier of sessionpage
- page to add
-
getDiskData
protected DiskPageStore.DiskData getDiskData(String sessionIdentifier, boolean create)
Get the data on disk for the given session identifier.- Parameters:
sessionIdentifier
- identifier of session- Returns:
- matching data
-
getSessionIdentifiers
public Set<String> 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
public List<IPersistedPage> getPersistedPages(String sessionIdentifier)
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
public Bytes 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
-
-