protected ResponseWriter createResponseWriter(FacesContext context) throws IOException, FacesException
{
ExternalContext extContext = context.getExternalContext();
RenderKit renderKit = context.getRenderKit();
// Avoid a cryptic NullPointerException when the renderkit ID
// is incorrectly set
if (renderKit == null)
{
String id = context.getViewRoot().getRenderKitId();
throw new IllegalStateException("No render kit was available for id \"" + id + "\"");
}
// set the buffer for content
if (_bufferSize != -1)
{
extContext.setResponseBufferSize(_bufferSize);
}
// get our content type
String contentType = (String) context.getAttributes().get("facelets.ContentType");
// get the encoding
String encoding = (String) context.getAttributes().get("facelets.Encoding");
// -= Leonardo Uribe =- Add */* to the contentType is a fix done from FaceletViewHandler
// to make old RI versions work, but since this is for JSF 2.0 it is not necessary that code.
ResponseWriter writer = renderKit.createResponseWriter(NullWriter.Instance, contentType, encoding);
//ResponseWriter writer;
// append */* to the contentType so createResponseWriter will succeed no matter
// the requested contentType.
//if (contentType != null && !contentType.equals("*/*"))