if (key == null )
{
// Check if clientWindow is enabled and if the last view key is stored
// into session, so we can use it to chain the precedence in GET-GET
// cases.
ClientWindow clientWindow = context.getExternalContext().getClientWindow();
if (clientWindow != null)
{
key = (SerializedViewKey) viewCollection.
getLastWindowKey(context, clientWindow.getId());
}
else if (isUseFlashScopePurgeViewsInSession(context.getExternalContext()) &&
Boolean.TRUE.equals(context.getExternalContext().getRequestMap()
.get("oam.Flash.REDIRECT.PREVIOUSREQUEST")))
{
key = (SerializedViewKey)
context.getExternalContext().getFlash().get(RESTORED_VIEW_KEY_REQUEST_ATTR);
}
}
}
SerializedViewKey nextKey = getSessionViewStorageFactory().createSerializedViewKey(
context, context.getViewRoot().getViewId(), getNextViewSequence(context));
viewCollection.add(context, serializeView(context, serializedView), nextKey, key);
ClientWindow clientWindow = context.getExternalContext().getClientWindow();
if (clientWindow != null)
{
//Update the last key generated for the current windowId in session map
viewCollection.putLastWindowKey(context, clientWindow.getId(), nextKey);
}
// replace the value to notify the container about the change
sessionMap.put(SERIALIZED_VIEW_SESSION_ATTR, viewCollection);
}