org.apache.wicket.pageStore.memory
Class HttpSessionDataStore

java.lang.Object
  extended by org.apache.wicket.pageStore.memory.HttpSessionDataStore
All Implemented Interfaces:
IDataStore

public class HttpSessionDataStore
extends Object
implements IDataStore

A IDataStore which stores the pages in the HttpSession. Uses IDataStoreEvictionStrategy to keep the memory footprint reasonable.

Usage:

 
 MyApp#init()
 {
 
        setPageManagerProvider(new DefaultPageManagerProvider() 
        {
                protected IDataStore newDataStore() 
                { 
                        return  new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(20));
                }
        }
 }
 
 


Constructor Summary
HttpSessionDataStore(IPageManagerContext pageManagerContext, IDataStoreEvictionStrategy evictionStrategy)
          Construct.
 
Method Summary
 boolean canBeAsynchronous()
           
 void destroy()
          Properly close the data store and possibly open resource handles
 byte[] getData(String sessionId, int pageId)
          Get data associated with the session id and page id.
 boolean isReplicated()
           
 void removeData(String sessionId)
          Remove all page data for the session id
 void removeData(String sessionId, int pageId)
          Remove all persisted data related to the session id and page id
 void storeData(String sessionId, int pageId, byte[] pageAsBytes)
          Store the page data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpSessionDataStore

public HttpSessionDataStore(IPageManagerContext pageManagerContext,
                            IDataStoreEvictionStrategy evictionStrategy)
Construct.

Parameters:
pageManagerContext -
evictionStrategy -
Method Detail

getData

public byte[] getData(String sessionId,
                      int pageId)
Description copied from interface: IDataStore
Get data associated with the session id and page id.

Specified by:
getData in interface IDataStore
Parameters:
sessionId - Ignored. Only pages from the current http session can be read
pageId - Page ID
Returns:
All the page data persisted
See Also:
IDataStore.getData(java.lang.String, int)

removeData

public void removeData(String sessionId,
                       int pageId)
Description copied from interface: IDataStore
Remove all persisted data related to the session id and page id

Specified by:
removeData in interface IDataStore
Parameters:
sessionId - Session ID
pageId - Page ID

removeData

public void removeData(String sessionId)
Description copied from interface: IDataStore
Remove all page data for the session id

Specified by:
removeData in interface IDataStore
Parameters:
sessionId - Session ID

storeData

public void storeData(String sessionId,
                      int pageId,
                      byte[] pageAsBytes)
Description copied from interface: IDataStore
Store the page data

Specified by:
storeData in interface IDataStore
Parameters:
sessionId - Session ID
pageId - Page ID
pageAsBytes - Page data

destroy

public void destroy()
Description copied from interface: IDataStore
Properly close the data store and possibly open resource handles

Specified by:
destroy in interface IDataStore

isReplicated

public boolean isReplicated()
Specified by:
isReplicated in interface IDataStore
Returns:
whether the data store is replicated

canBeAsynchronous

public final boolean canBeAsynchronous()
Specified by:
canBeAsynchronous in interface IDataStore
Returns:
whether the implementation can be wrapped in AsynchronousDataStore


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.