我正在使用 pentaho classic 生成一个 html 报告。我们在部署应用程序的节点之前有一个负载均衡器。
代码如下:
if(reportType.equals("HTML")) {
response.setContentType("text/html");
response.setHeader("content-type","text/html");
(report,response.getOutputStream());
final StreamRepository targetRepository = new StreamRepository(response.getOutputStream());
final ContentLocation targetRoot = targetRepository.getRoot();
final HtmlOutputProcessor outputProcessor = new StreamHtmlOutputProcessor(report.getConfiguration());
final HtmlPrinter printer = new AllItemsHtmlPrinter(report.getResourceManager());
printer.setContentWriter(targetRoot, new DefaultNameGenerator(targetRoot, "index", "html"));
printer.setDataWriter(null, null);
printer.setUrlRewriter(new FileSystemURLRewriter());
outputProcessor.setPrinter(printer);
AbstractReportProcessor reportProcessor = new StreamReportProcessor(report, outputProcessor);
// Generate the report
reportProcessor.processReport();
reportProcessor.close();
log.info("html");
return "html";
}
报告已正确生成。但是,在报告末尾出现以下二进制代码。
PK�l�BO�j))mimetypeapplication/vnd.pentaho.reporting.classicPK�l�BMETA-INF/manifest.xml͗�n�@���wq��bj��/�>��mK�@� �ԿniM�v�[�}S/�s�s1.ׇ^f{�(�jII�H��N�mK�^_�g�^-�=Sb��E�)<����[ ......
非常感谢。
大卫。