private static final RendererBase renderer = new DummyRenderer();
/* (non-Javadoc)
* @see org.ajax4jsf.resource.BaseResourceRenderer#send(org.ajax4jsf.resource.InternetResource, org.ajax4jsf.resource.ResourceContext)
*/
public int send(InternetResource base, ResourceContext context) throws IOException {
PreparedTemplate template = null;
CountingOutputWriter countingOutputWriter = new CountingOutputWriter();
template = getTemplate(base, context);
FacesContext facesContext = FacesContext.getCurrentInstance();
boolean _CompressStyleOn = !"false".equals(facesContext.getExternalContext()
.getInitParameter(COMPRESS_STYLE_PARAMETER));
Writer writer = context.getWriter();
int bytesLength;
if(null != facesContext) {
// Create responseWriter.
String defaultRenderKitId = facesContext.getApplication().getDefaultRenderKitId();
if (null == defaultRenderKitId) {
defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
}
// RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
// RenderKit renderKit = renderKitFactory.getRenderKit(facesContext,defaultRenderKitId);
// // TODO - handle response encoding
//
// ResponseWriter responseWriter = renderKit.createResponseWriter(countingOutputWriter,null,"UTF-8");
TextCssResponseWriter responseWriter = new TextCssResponseWriter(writer);
facesContext.setResponseWriter(responseWriter);
responseWriter.startDocument();
// TODO - parameters and mock renderer/component ?
// for first time, this template only allow skin or faces variables interaction
template.encode(renderer,facesContext,null);
responseWriter.endDocument();
responseWriter.flush();
responseWriter.close();
if (_CompressStyleOn) {