use of javax.faces.render.RenderKit in project acs-community-packaging by Alfresco.
the class InvokeCommand method setupResponseWriter.
/**
* setup the JSF response writer.
*/
private ResponseWriter setupResponseWriter(final String mimetype, final HttpServletResponse response, final FacesContext facesContext) throws IOException {
final OutputStream os = response.getOutputStream();
final UIViewRoot viewRoot = facesContext.getViewRoot();
final RenderKitFactory renderFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
final RenderKit renderKit = renderFactory.getRenderKit(facesContext, viewRoot.getRenderKitId());
final ResponseWriter writer = renderKit.createResponseWriter(new OutputStreamWriter(os, "UTF-8"), mimetype, "UTF-8");
facesContext.setResponseWriter(writer);
// must be text/xml otherwise IE doesn't parse the response properly into responseXML
response.setContentType(mimetype);
return writer;
}
Aggregations