1

Our customers might have huge records and whole download process may took more than 10 minutes.

Here our purpose is show customer some error message if download took 8 minutes.

Somehow during the process, I notice another request coming from controller exactly after 5 minutes.

Jquery

        $('#Running.modal').off().on('shown.bs.modal', function () {
            $.fileDownload("accountsummary/pdfPrint", {
                httpMethod: 'POST',
                data: $(PDFPrintForm).serializeObject(),
                cookiePath: '/myCMS/',
                successCallback: function (url) {
                    $("#Running.modal").modal('hide');
                    PDFPrintForm.remove();
                },
                failCallback: function (html, url) {
                    PDFPrintForm.remove();
                    $("#Running.modal").modal('hide');
                    $("#Failed.modal").modal({show: true});

                }
            });
        })

Back-end

If hits 8 minutes

logger.info("PDF transaction history download hits {} seconds", sec);
OutputStream outputStream;
outputStream = response.getOutputStream();
outputStream.write(errorMessage.getBytes(Charset.forName("UTF-8")));
outputStream.close();
return;

Success

Cookie c = new Cookie("fileDownload", "true");
c.setPath("/");
response.addCookie(c);
response.setHeader("Content-Disposition" , "attachment; filename=\"Account Summary-Savings/Current Account Details.pdf\"");
response.setContentType("application/pdf");
response.flushBuffer();
Vanan
  • 107
  • 1
  • 2
  • 9

0 Answers0