Search code examples
pentaho

Pentaho : the binary zip code is added at the end of html report


I am generating a html report with pentaho classic.We have a load balancer before the nodes where the app is deployed.

The code is the following:

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";
            } 

The report is generated correctly.However, at the end of the report apper the following binary code.

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�)<ݶ�[�h��z���FP�� ...

Many thanks.

David.


Solution

  • The binary stuff is the actual PRPT file. Nothing of the code you posted would be able to append that file - so it must be some other code that adds that stuff. Given the fact that this code fragment is not a full servlet, anything is possible.

    Do the classical debugging routine: Run your servlet without a load balancer. If the garbage goes away, fix your balancer configuration.

    Second, check what filters are active for your request. Filters can pre- and post-process reponses and therefore can add additional content that your servlet may not be aware of.