org.wicketstuff.shiro.wicket.page.store
Class SessionPageStore

java.lang.Object
  extended by org.wicketstuff.shiro.wicket.page.store.SessionPageStore
All Implemented Interfaces:
IPageStore

public class SessionPageStore
extends Object
implements IPageStore

An IPageStore implementation that stores serialized Pages in JSecurity's Session. This implementation exists to support applications that use JSecurity's Enterprise Sessions instead of HTTP-only sessions.

In a distributed application, the JSecurity Session data might not reside on the same host that runs the Wicket application. In these cases the default DiskPageStore used by Wicket is not suitable. Instead Page state must be serialized to a mechanism that is 'cluster-friendly'.

JSecurity's enterprise Sessions are cluster-friendly, so storing pages in the Session is a good choice. This means applications can utilize true generic load balancing and do not need sticky sessions - the Wicket PageMap can be updated on one host which is then available for any next load-balanced request on another host because the Session is clustered.

Author:
Les Hazlewood, Sebastian Thomschke

Field Summary
protected static int DEFAULT_MAX_PAGES
           
 
Constructor Summary
SessionPageStore()
           
SessionPageStore(int maxPageMapSize)
           
 
Method Summary
 boolean containsPage(String sessionId, int pageId)
           
 IManageablePage convertToPage(Object page)
          
protected  IManageablePage deserializePage(byte[] data)
           
 void destroy()
          
 int getMaxPageMapSize()
           
 Page getPage(String sessionId, int pageId)
          
protected  PageCacheManager getPageCacheManager(String sessionId)
           
protected  org.apache.shiro.session.Session getSession(String sessionId)
           
protected  org.apache.shiro.session.Session getSessionForUpdate(String sessionId)
           
 void pageAccessed(String sessionId, Page page)
           
 Serializable prepareForSerialization(String sessionId, Object page)
          
 void removePage(String sessionId, int pageId)
          
 Object restoreAfterSerialization(Serializable serializable)
          
protected  SerializedPageWrapper serialize(String sessionId, IManageablePage page)
           
protected  byte[] serializePage(String sessionId, IManageablePage page)
           
 void storePage(String sessionId, IManageablePage page)
          
 void unbind(String sessionId)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_PAGES

protected static final int DEFAULT_MAX_PAGES
See Also:
Constant Field Values
Constructor Detail

SessionPageStore

public SessionPageStore()

SessionPageStore

public SessionPageStore(int maxPageMapSize)
Method Detail

containsPage

public boolean containsPage(String sessionId,
                            int pageId)

convertToPage

public IManageablePage convertToPage(Object page)

Specified by:
convertToPage in interface IPageStore

deserializePage

protected IManageablePage deserializePage(byte[] data)

destroy

public void destroy()

Specified by:
destroy in interface IPageStore

getMaxPageMapSize

public int getMaxPageMapSize()

getPage

public Page getPage(String sessionId,
                    int pageId)

Specified by:
getPage in interface IPageStore

getPageCacheManager

protected PageCacheManager getPageCacheManager(String sessionId)

getSession

protected org.apache.shiro.session.Session getSession(String sessionId)

getSessionForUpdate

protected org.apache.shiro.session.Session getSessionForUpdate(String sessionId)

pageAccessed

public void pageAccessed(String sessionId,
                         Page page)

prepareForSerialization

public Serializable prepareForSerialization(String sessionId,
                                            Object page)

Specified by:
prepareForSerialization in interface IPageStore

removePage

public void removePage(String sessionId,
                       int pageId)

Specified by:
removePage in interface IPageStore

restoreAfterSerialization

public Object restoreAfterSerialization(Serializable serializable)

Specified by:
restoreAfterSerialization in interface IPageStore

serialize

protected SerializedPageWrapper serialize(String sessionId,
                                          IManageablePage page)

serializePage

protected byte[] serializePage(String sessionId,
                               IManageablePage page)

storePage

public void storePage(String sessionId,
                      IManageablePage page)

Specified by:
storePage in interface IPageStore

unbind

public void unbind(String sessionId)

Specified by:
unbind in interface IPageStore


Copyright © 2015. All Rights Reserved.