facesContext.setResponseWriter(responseWriter);
encodeDocumentProlog(facesContext, viewRoot, responseWriter);
ViewResources viewResources = new ViewResources();
viewResources.initialize(facesContext);
//viewResources.setStyleStrategy(InternetResourceBuilder.LOAD_ALL);
//viewResources.setScriptStrategy(InternetResourceBuilder.LOAD_ALL);
viewResources.setUseStdControlsSkinning(false);
viewResources.setUseStdControlsSkinningClasses(false);
renderChild(facesContext, viewRoot);
encodeDocumentEpilog(facesContext, viewRoot, responseWriter);
viewResources.processHeadResources(facesContext);
Object[] headEvents = (Object[]) viewResources.getHeadEvents();
request.setAttribute(AjaxContext.HEAD_EVENTS_PARAMETER, headEvents);
facesContext.setResponseWriter(writer);
}
}, request, response);