}
SerializedViewKey nextKey = getSessionViewStorageFactory().createSerializedViewKey(
context, context.getViewRoot().getViewId(), getNextViewSequence(context));
// Get viewScopeMapId
ViewScopeProxyMap viewScopeProxyMap = null;
Object viewMap = context.getViewRoot().getViewMap(false);
if (viewMap != null)
{
while (viewMap != null)
{
if (viewMap instanceof ViewScopeProxyMap)
{
viewScopeProxyMap = (ViewScopeProxyMap)viewMap;
break;
}
else if (viewMap instanceof FacesWrapper)
{
viewMap = ((FacesWrapper)viewMap).getWrapped();
}
}
}
if (viewScopeProxyMap != null)
{
ViewScopeProviderFactory factory = ViewScopeProviderFactory.getViewScopeHandlerFactory(
context.getExternalContext());
ViewScopeProvider handler = factory.getViewScopeHandler(context.getExternalContext());
viewCollection.put(context, serializeView(context, serializedView), nextKey, key,
handler, viewScopeProxyMap.getViewScopeId());
}
else
{
viewCollection.put(context, serializeView(context, serializedView), nextKey, key);
}