@SuppressWarnings("unchecked")
@Override
public UIViewRoot restoreView (FacesContext context, String viewId, String renderKitId)
{
ResponseStateManager manager;
Object state[];
Map<String, Object> states;
UIViewRoot view = null;
// The value returned here is expected to be false (set by RestoreViewExecutor), but
//we don't know if some ViewHandler wrapper could change it, so it is better to save the value.
final boolean oldContextEventState = context.isProcessingEvents();
// Get previous state from ResponseStateManager.
manager = RendererUtils.getResponseStateManager (context, renderKitId);
//state = (Object[]) getStateCache().restoreSerializedView(context, viewId, manager.getState(context, viewId));
state = (Object[]) manager.getState(context, viewId);
if (state == null)
{
//No state could be restored, return null causing ViewExpiredException
return null;