{
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);
}