@Override
public UIViewRoot restoreView(FacesContext facesContext, String viewId, String renderKitId)
{
if (log.isLoggable(Level.FINEST)) log.finest("Entering restoreView - viewId: "+viewId+" ; renderKitId: "+renderKitId);
UIViewRoot uiViewRoot = null;
ViewDeclarationLanguage vdl = facesContext.getApplication().
getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
StateManagementStrategy sms = null;
if (vdl != null)
{
sms = vdl.getStateManagementStrategy(facesContext, viewId);
}
if (sms != null)
{
if (log.isLoggable(Level.FINEST)) log.finest("Redirect to StateManagementStrategy: "+sms.getClass().getName());
uiViewRoot = sms.restoreView(facesContext, viewId, renderKitId);
}
else
{
RenderKit renderKit = getRenderKitFactory().getRenderKit(facesContext, renderKitId);
ResponseStateManager responseStateManager = renderKit.getResponseStateManager();
Object state = responseStateManager.getState(facesContext, viewId);
if (state != null) {
Object[] stateArray = (Object[])state;
TreeStructureManager tsm = new TreeStructureManager();
uiViewRoot = tsm.restoreTreeStructure(stateArray[0]);
if (uiViewRoot != null) {
facesContext.setViewRoot (uiViewRoot);
uiViewRoot.processRestoreState(facesContext, stateArray[1]);
}
}
}
if (log.isLoggable(Level.FINEST)) log.finest("Exiting restoreView - "+viewId);