public int writeCatalog ( HttpServletRequest req , HttpServletResponse res , Catalog cat , boolean isLocalCatalog ) throws IOException { String catHtmlAsString = convertCatalogToHtml ( cat , isLocalCatalog ) ; // Once this header is set, we know the encoding, and thus the actual // number of *bytes*, not characters, to encode res . setContentType ( ContentType . html . getContentHeader ( ) ) ; int len = ServletUtil . setResponseContentLength ( res , catHtmlAsString ) ; if ( ! req . getMethod ( ) . equals ( "HEAD" ) ) { PrintWriter writer = res . getWriter ( ) ; writer . write ( catHtmlAsString ) ; writer . flush ( ) ; } return len ; }
Write an Catalog to the HttpServletResponse return the size in bytes of the catalog written to the response .