protected void writeContent ( String requestedPath , HttpServletRequest request , HttpServletResponse response ) throws IOException , ResourceNotFoundException { // Send gzipped resource if user agent supports it. int idx = requestedPath . indexOf ( BundleRenderer . GZIP_PATH_PREFIX ) ; if ( idx != - 1 ) { requestedPath = JawrConstant . URL_SEPARATOR + requestedPath . substring ( idx + BundleRenderer . GZIP_PATH_PREFIX . length ( ) , requestedPath . length ( ) ) ; if ( isValidRequestedPath ( requestedPath ) ) { response . setHeader ( CONTENT_ENCODING , GZIP ) ; bundlesHandler . streamBundleTo ( requestedPath , response . getOutputStream ( ) ) ; } else { throw new ResourceNotFoundException ( requestedPath ) ; } } else { // In debug mode, we take in account the image generated from a // StreamGenerator like classpath Image generator // The following code will rewrite the URL path for the generated // images, // because in debug mode, we are retrieving the CSS resources // directly from the webapp // and if the CSS contains generated images, we should rewrite the // URL. BinaryResourcesHandler imgRsHandler = ( BinaryResourcesHandler ) servletContext . getAttribute ( JawrConstant . BINARY_CONTEXT_ATTRIBUTE ) ; if ( imgRsHandler != null && this . jawrConfig . isDebugModeOn ( ) && resourceType . equals ( JawrConstant . CSS_TYPE ) ) { handleGeneratedCssInDebugMode ( requestedPath , request , response , imgRsHandler ) ; } else { if ( isValidRequestedPath ( requestedPath ) ) { Writer out = response . getWriter ( ) ; bundlesHandler . writeBundleTo ( requestedPath , out ) ; } else { throw new ResourceNotFoundException ( requestedPath ) ; } } } }
Writes the content to the output stream