spring - Avoid timeout on long running process of report generation -
i have webapp developed using spring mvc. using jasperreports generate series of reports user download. in several of these reports, filling them jasper takes long , causes either transaction timeout, tomcat timeout or gateway timeout on client side.
what's solution long-running processes this? note should somehow inform user whenever process finished can download file.
the cleanest way handle such issue have asyncronous communication client.
the first request /myapp/report?name=...¶mters...
triggers jasper report refresh report , returns ticket id
then, client have call url retrieve report (for instance every 5 seconds) /myapp/reportdownload?ticketid=xxxxx
if jasper thread on , report ready, send report, otherwise tell client retry in 5 seconds until gets report.
the way implement depends on technlogies using in front , backends, you'll find dozen of tutorials on internet.
the worst way fix increase timeout in connector configuration (http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)
hih
Comments
Post a Comment