I have a report which displays some information in a report and I have link in the report to export to CSV. To download the csv file what we are doing is ,
public class ReportServlet extends XYXServlet{
public void service(HttpServletRequest req, HttpServletResponse res) throws Exception {
...................
...................
res.setContentType("text/csv");
res.setHeader("Content-Disposition","attachment; filename=\""+reportName+"\"");
OutputStream out = res.getOutputStream();
// Render the report
ReportRender.renderReport(report,results,out,rtParam);
out.close();
}
}
This report is for one patient. Now I have the requirement where I have to download report for all the patient in the system. We have more than 5000 patients. It is a one time download. SO basically I should have one CSV file per patient .eg filename will be xyzreport-patientId. We are using velocity template . Basically ReportRender will take the report result and merge with the template using velocity template. like
VelocityContext c = new VelocityContext(params);
Writer w = new OutputStreamWriter(out);
template.merge(c,w);
w.flush();
So now my problem is how do I download all report for all patients at one time. Can I use one request/response to download reports for all patients?