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