Reputation: 66
I am facing a problem with a servlet that generates a big excel file created with POI. This servlet executes a code similar to this:
// (...)
// set headers and names
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment;filename="
+ fileName + ".xlsx");
workbook = new SXSSFWorkbook(flushLimit);
workbook.setCompressTempFiles(true);
while (resultSet.next()) {
// add rows and cell to excel file
//(...) about 3000000 rows
}
logger.info("Writing and closing to temp file");
workbook.write(fileOutputStream);
logger.info("Dispose Workbook");
workbook.dispose();
logger.info("Closing fileOutputStream");
IOUtils.closeQuietly(fileOutputStream);
logger.info("Passing file to servlet outputstream");
fileInputStream=new FileInputStream(tempFileOutput);
IOUtils.copy(fileInputStream, response.getOutputStream());
logger.info("Closing fileInputStream");
IOUtils.closeQuietly(fileInputStream);
// delete temporal file
try {
tempFileOutput.delete();
} catch (Exception e) {
logger.error("Error trying to delete file");
}
// close servlet
response.getOutputStream().flush();
response.getOutputStream().close();
When servlet takes more than 10 minutes to generate the report and the file sizes is about 100mb it sometimes shows a web saying Internal problem(with no more information) or in other cases the page remains loading. Despite, the excel file is generated correctly but the transmission was cancelled.
Is there a configuration prevent OAS aborts the connection?
Upvotes: 0
Views: 55