- All Implemented Interfaces:
IPageStore
,IPersistentPageStore
All pages passed into this store are restricted to be SerializedPage
s.
While DiskPageStore
uses a single file per session, this implementation stores each page
in its own file. This improves on a disadvantage of DiskPageStore
surfacing
with alternating Ajax requests from different browser tabs.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
Constructor Summary
ConstructorDescriptionFilePageStore
(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.protected String
getPageType
(File file) Get the type of page from the given file.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 byte[]
Read a file.protected void
removeAllPersistedPages
(String sessionIdentifier) protected void
removePersistedPage
(String sessionIdentifier, IManageablePage page) protected void
setPageType
(File file, String pageType) Set the type of page on the given file.boolean
Pages are always serialized, so versioning is supported.protected void
Write a file with given data.Methods inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
addPage, canBeAsynchronous, createSessionIdentifier, destroy, 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, destroy, detach, end, getPage, removeAllPages, removePage, revertPage
Methods inherited from interface org.apache.wicket.pageStore.IPersistentPageStore
getSessionIdentifier
-
Constructor Details
-
FilePageStore
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 always serialized, so versioning is supported.- Specified by:
supportsVersioning
in interfaceIPageStore
-
getPersistedPage
- Specified by:
getPersistedPage
in classAbstractPersistentPageStore
-
readFile
Read a file.Note: This implementation uses a
FileChannel
.- Parameters:
file
- file to read- Throws:
IOException
-
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
-
writeFile
Write a file with given data.Note: This implementation uses a
FileChannel
withStandardOpenOption.TRUNCATE_EXISTING
. This might fail on Windows systems with "The requested operation cannot be performed on a file with a user-mapped section open", so subclasses can omit this option to circumvent this error, although this prevents files from shrinking when pages become smaller. Alternatively a completely different implementation can be chosen.- Parameters:
file
- file to writedata
- data to write- Throws:
IOException
-
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
- identifier of the session.- Returns:
- all persisted pages
-
getPageType
Get the type of page from the given file.This is an optional operation that returns
null
in case of any error.- Parameters:
file
-- Returns:
- pageType
-
setPageType
Set the type of page on the given file.This is an optional operation that silently fails in case of an error.
- Parameters:
file
-pageType
-
-
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
-