Package org.apache.wicket.pageStore
Class FilePageStore
- java.lang.Object
-
- org.apache.wicket.pageStore.AbstractPersistentPageStore
-
- org.apache.wicket.pageStore.FilePageStore
-
- All Implemented Interfaces:
IPageStore,IPersistentPageStore
public class FilePageStore extends AbstractPersistentPageStore implements IPersistentPageStore
A storage of pages in files.All pages passed into this store are restricted to be
SerializedPages.While
DiskPageStoreuses a single file per session, this implementation stores each page in its own file. This improves on adisadvantage of DiskPageStoresurfacing with alternating Ajax requests from different browser tabs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classFilePageStore.LastModifiedComparator-
Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
-
Constructor Summary
Constructors Constructor Description FilePageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession)Create a store that supportsSerializedPages only.FilePageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession, ISerializer serializer)Create a store to files.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPersistedPage(java.lang.String sessionIdentifier, IManageablePage page)Add a page.protected java.lang.StringgetPageType(java.io.File file)Get the type of page from the given file.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)protected voidsetPageType(java.io.File file, java.lang.String pageType)Set the type of page on the given file.booleansupportsVersioning()Pages are always serialized, so versioning is supported.-
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, getPage, removeAllPages, removePage
-
Methods inherited from interface org.apache.wicket.pageStore.IPersistentPageStore
getSessionIdentifier
-
-
-
-
Constructor Detail
-
FilePageStore
public FilePageStore(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
-
FilePageStore
public FilePageStore(java.lang.String applicationName, java.io.File fileStoreFolder, org.apache.wicket.util.lang.Bytes maxSizePerSession, ISerializer serializer)Create a store to files.- 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 always serialized, so versioning is supported.- Specified by:
supportsVersioningin interfaceIPageStore
-
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
-
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- Returns:
- all persisted pages
-
getPageType
protected java.lang.String getPageType(java.io.File file)
Get the type of page from the given file.This is an optional operation that returns
nullin case of any error.- Parameters:
file-- Returns:
- pageType
-
setPageType
protected void setPageType(java.io.File file, java.lang.String pageType)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
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
-
-