简体   繁体   中英

Stopping HTTP Request Timeout in Spring

I have an application and I am generating Jasper Reports from it. But when I make request to generate the report, the time taken for the application to generate the report is quite long because the data set is very large(~100K rows) for the report.

So, by the time the report is generated successfully, the HTTP request gets timed out and the report is never downloaded.

How can I prevent this from happening?

The application is build with Spring 3.0, Hibernate and JasperReports.

The quick solution will be to add a timeout parameter to your Http request.

A cleaner solution is:

  • Kick off the report generation with one Ajax request (Use spring scheduler to schedule for immediate execution)
  • Poll from the browser to check the status of the report; when found done, present the report.

My guess is that your session is expiring at 20 minutes, try editing tomcat6/webapps/jasperserver/WEB-INF/web.xml

<session-config>
    <!-- Default to 20 minute session timeouts -->
    <session-timeout>120</session-timeout>
</session-config>

Also make use of 'Run in background' (right-click) which will save the output for you like a schedule.

You can check tomcat6/webapps/jasperserver/WEB-INF/logs/jasperserver.log for any error messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM