@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;