Package org.apache.wicket.pageStore
Class InSessionPageStore
- java.lang.Object
-
- org.apache.wicket.pageStore.InSessionPageStore
-
- All Implemented Interfaces:
IPageStore
public class InSessionPageStore extends Object implements IPageStore
A store keeping a configurable maximum of pages in the session.Note: see
getKey()
for using more than once instance in an application
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
InSessionPageStore.SessionData
Data kept in theSession
, might get serialized along with its containingHttpSession
.
-
Constructor Summary
Constructors Constructor Description InSessionPageStore(int maxPages)
KeepmaxPages
persistent in each session.InSessionPageStore(int maxPages, ISerializer serializer)
Keep a cache ofmaxPages
in each session.InSessionPageStore(Bytes maxBytes)
Keep page up tomaxBytes
persistent in each session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPage(IPageContext context, IManageablePage page)
Stores the page-protected MetaDataKey<InSessionPageStore.SessionData>
getKey()
Session data is stored under aMetaDataKey
.IManageablePage
getPage(IPageContext context, int id)
Restores a page from storage.void
removeAllPages(IPageContext context)
All pages should be removed from storage for the given context.void
removePage(IPageContext context, IManageablePage page)
Removes a page from storage.boolean
supportsVersioning()
Is versioning of pages supported, i.e.-
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
canBeAsynchronous, destroy, detach, end, revertPage
-
-
-
-
Constructor Detail
-
InSessionPageStore
public InSessionPageStore(int maxPages)
KeepmaxPages
persistent in each session.Any page added to this store not being a
SerializedPage
will be dropped on serialization of the session.- Parameters:
maxPages
- maximum pages to keep in session
-
InSessionPageStore
public InSessionPageStore(Bytes maxBytes)
Keep page up tomaxBytes
persistent in each session.All pages added to this store must be
SerializedPage
s. You can achieve this by letting aSerializingPageStore
delegate to this store.- Parameters:
maxBytes
- maximum bytes to keep in session
-
InSessionPageStore
public InSessionPageStore(int maxPages, ISerializer serializer)
Keep a cache ofmaxPages
in each session.If the container serializes sessions to disk, any non-
SerializedPage
added to this store will be automatically serialized.- Parameters:
maxPages
- maximum pages to keep in sessionserializer
- optional serializer used only in case session serialization
-
-
Method Detail
-
getPage
public IManageablePage getPage(IPageContext context, int id)
Description copied from interface:IPageStore
Restores a page from storage.- Specified by:
getPage
in interfaceIPageStore
- Parameters:
context
- the context of the pageid
- the id of the page.- Returns:
- the page
-
addPage
public void addPage(IPageContext context, IManageablePage page)
Description copied from interface:IPageStore
Stores the page-- Specified by:
addPage
in interfaceIPageStore
- Parameters:
context
- the context of the pagepage
- the page.
-
removePage
public void removePage(IPageContext context, IManageablePage page)
Description copied from interface:IPageStore
Removes a page from storage.- Specified by:
removePage
in interfaceIPageStore
- Parameters:
context
- the context of the pagepage
- the page.
-
removeAllPages
public void removeAllPages(IPageContext context)
Description copied from interface:IPageStore
All pages should be removed from storage for the given context.- Specified by:
removeAllPages
in interfaceIPageStore
- Parameters:
context
- the context of the pages
-
getKey
protected MetaDataKey<InSessionPageStore.SessionData> getKey()
Session data is stored under aMetaDataKey
.In the unlikely case that an application utilizes more than one instance of this store, this method has to be overridden to provide a separate key for each instance.
-
supportsVersioning
public boolean supportsVersioning()
Description copied from interface:IPageStore
Is versioning of pages supported, i.e. when an altered page instance has been stored in this store, can the previous state of that page still be retrieved under its former page id. Most implementations achieve this by keeping a copy of the page instance, e.g. by means of serialization.- Specified by:
supportsVersioning
in interfaceIPageStore
-
-