Is there a way to convert the outputstream to base64outputstream, everything works except for the last part in which I don't get anything, neither log nor error, just a blank screen when executed. It is supposed that with this the report should be downloaded in pdf format when pressing generate report in the jsp page.
//THIS IS A SERVLET
private void report(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, JRException {
try {
//LIST FROM DATABASE MYSQL
List<Bienes> data = servicio.generarReporte();
//LIST TO JRBEANCOLLECTION AS DATASOURCE FOR REPORT
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(data);
//REPORT JASPER
String file = request.getServletContext().getRealPath("/webapp/ReporteBienes.jasper");
FileInputStream stream = new FileInputStream(new File(file));
//PARAMETERS (nothing for now)
Map<String,Object> params = new HashMap<String,Object>();
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(stream);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
response.setContentType("application/x-pdf");
response.addHeader("content-disposition","attachment;filename=ReporteBienes.pdf");
//HERE IS THE PROBLEM: Type missmatch: cannot convert from ServletOutputStream to Base64.OutputStream
OutputStream outStream = response.getOutputStream();
//exportReportToPdfStream(JasperPrint jasperPrint, OutputStream outputStream)
//does not accept Servletoutputstream and I get a blank screen for it
JasperExportManager.exportReportToPdfStream(jasperPrint, outStream);
}
catch(Exception e) {
e.printStackTrace();
}
}