Class 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

    • Constructor Detail

      • InSessionPageStore

        public InSessionPageStore​(int maxPages)
        Keep maxPages 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​(org.apache.wicket.util.lang.Bytes maxBytes)
        Keep page up to maxBytes persistent in each session.

        All pages added to this store must be SerializedPages. You can achieve this by letting a SerializingPageStore delegate to this store.

        Parameters:
        maxBytes - maximum bytes to keep in session
      • InSessionPageStore

        public InSessionPageStore​(int maxPages,
                                  ISerializer serializer)
        Keep a cache of maxPages 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 session
        serializer - 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 interface IPageStore
        Parameters:
        context - the context of the page
        id - the id of the page.
        Returns:
        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 interface IPageStore
        Parameters:
        context - the context of the pages
      • getKey

        protected MetaDataKey<InSessionPageStore.SessionData> getKey()
        Session data is stored under a MetaDataKey.

        In cases where more than one instance is used in an application (e.g. as a fast cache and a persistent store of serialized pages in the session), 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 interface IPageStore