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 java.lang.Object
implements IDataStore

A DataStore which stores the pages in the HttpSession. Uses DataStoreEvictionStrategy 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, DataStoreEvictionStrategy evictionStrategy)
          Construct.
 
Method Summary
 void destroy()
          Properly close the data store and possibly open resource handles
 byte[] getData(java.lang.String sessionId, int pageId)
          Get data associated with the session id and page id.
 boolean isReplicated()
           
 void removeData(java.lang.String sessionId)
          Remove all page data for the session id
 void removeData(java.lang.String sessionId, int pageId)
          Remove all persisted data related to the session id and page id
 void storeData(java.lang.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,
                            DataStoreEvictionStrategy evictionStrategy)
Construct.

Parameters:
pageManagerContext -
evictionStrategy -
Method Detail

getData

public byte[] getData(java.lang.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(java.lang.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(java.lang.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(java.lang.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


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