@Override public UIViewRoot restoreView(FacesContext context, String viewId) { UIViewRoot viewRoot = super.restoreView(context, viewId); return addSkinningResourcesToViewRoot(context, viewRoot); }
public UIViewRoot restoreView(FacesContext context, String viewId) { String resourcePath = viewId; if (JsfUtils.isFlowRequest()) { resourcePath = resolveResourcePath(RequestContextHolder.getRequestContext(), viewId); return restoreFlowView(context, resourcePath); } return super.restoreView(context, resourcePath); }
public UIViewRoot restoreView(FacesContext context, String viewId) { String resourcePath = viewId; if (JsfUtils.isFlowRequest()) { resourcePath = resolveResourcePath(RequestContextHolder.getRequestContext(), viewId); return restoreFlowView(context, resourcePath); } return super.restoreView(context, resourcePath); }
@Override public UIViewRoot restoreView(FacesContext context, String viewId) { if (SpringFacesContext.getCurrentInstance() != null && SpringFacesContext.getCurrentInstance().getRendering() != null) { ModelAndViewArtifact rendering = SpringFacesContext.getCurrentInstance().getRendering(); context.getAttributes().put(ACTION_ATTRIBUTE, rendering.getViewArtifact().toString()); return super.restoreView(context, rendering.getViewArtifact().toString()); } return super.restoreView(context, viewId); }
@Override public UIViewRoot restoreView(FacesContext context, String viewId) { if (PortletUtil.isPortletRequest(context)) { PortletRequest request = (PortletRequest) context.getExternalContext().getRequest(); String portletViewId = request.getParameter(MyFacesGenericPortlet.VIEW_ID); Application application = context.getApplication(); ViewHandler applicationViewHandler = application.getViewHandler(); String renderKitId = applicationViewHandler.calculateRenderKitId(context); UIViewRoot viewRoot = application.getStateManager().restoreView(context, portletViewId, renderKitId); return viewRoot; } return super.restoreView(context, viewId); }
/** * If the current request is an unload request from {@link ViewScoped}, then create a dummy view, restore only the * view root state and then immediately explicitly destroy the view, else restore the view as usual. If the * <code><o:enableRestoreView></code> is used once in the application, and the restored view is null and the * current request is a postback, then recreate and rebuild the view from scratch. If it indeed contains the * <code><o:enableRestoreView></code>, then return the newly created view, else return <code>null</code>. */ @Override public UIViewRoot restoreView(FacesContext context, String viewId) { if (isUnloadRequest(context)) { return unloadView(context, viewId); } UIViewRoot restoredView = super.restoreView(context, viewId); if (isRestorableViewRequest(context, restoredView)) { return createRestorableViewIfNecessary(viewId); } return restoredView; }
/** * If the current request is an unload request from {@link ViewScoped}, then create a dummy view, restore only the * view root state and then immediately explicitly destroy the view, else restore the view as usual. If the * <code><o:enableRestoreView></code> is used once in the application, and the restored view is null and the * current request is a postback, then recreate and rebuild the view from scratch. If it indeed contains the * <code><o:enableRestoreView></code>, then return the newly created view, else return <code>null</code>. */ @Override public UIViewRoot restoreView(FacesContext context, String viewId) { if (isUnloadRequest(context)) { return unloadView(context, viewId); } UIViewRoot restoredView = super.restoreView(context, viewId); if (isRestorableViewRequest(context, restoredView)) { return createRestorableViewIfNecessary(viewId); } return restoredView; }
private UIViewRoot restoreFlowView(FacesContext facesContext, String resourcePath) { RequestContext context = RequestContextHolder.getRequestContext(); ViewRootHolder holder = (ViewRootHolder) context.getFlashScope().get(View.USER_EVENT_STATE_ATTRIBUTE); if (holder != null && holder.getViewRoot() != null && holder.getViewRoot().getViewId().equals(resourcePath)) { if (facesContext instanceof FlowFacesContext) { ((FlowFacesContext) facesContext).setViewRootRestoredFromFlashScope(); } return holder.getViewRoot(); } else { return super.restoreView(facesContext, resourcePath); } } }
private UIViewRoot restoreFlowView(FacesContext facesContext, String resourcePath) { RequestContext context = RequestContextHolder.getRequestContext(); ViewRootHolder holder = (ViewRootHolder) context.getFlashScope().get(View.USER_EVENT_STATE_ATTRIBUTE); if (holder != null && holder.getViewRoot() != null && holder.getViewRoot().getViewId().equals(resourcePath)) { if (facesContext instanceof FlowFacesContext) { ((FlowFacesContext) facesContext).setViewRootRestoredFromFlashScope(); } return holder.getViewRoot(); } else { return super.restoreView(facesContext, resourcePath); } } }