/**
* {@inheritDoc}
*/
public Serializable prepareForSerialization(String sessionId, Object page)
{
SerializedPageWithSession result = null;
if (page instanceof Page)
{
result = serializedPagesCache.getPage((Page)page);
if (result == null)
{
List<SerializedPage> serialized = serializePage((Page)page);
result = serializedPagesCache.storePage(sessionId, (Page)page, serialized);
}
}
else if (page instanceof SerializedPageWithSession)
{
SerializedPageWithSession serialized = (SerializedPageWithSession)page;
if (serialized.page.get() == SerializedPageWithSession.NO_PAGE)
{
// stripped page, need to restore it first
result = restoreStrippedSerializedPage(serialized);
}