My code downloads a file from back-end server. Since we will be retrieving records numbering in millions, we have used Struts2 execAndWait
Interceptor. To test this, we are inserting delay of 30 secs.
I'm able to download file without inserting delay (where test data very small), but after inserting it, i never get the file. Logs show that action class is being repeatedly executed due to <meta-refresh>
of 5 secs in wait file, even input-stream is populated.
What could be the reason for such behaviour ?
Code Set-up:
Struts.xml:
<action name="file-download" class="com.company.namespace.test.TestDownloadActionClass">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="execAndWait">
<param name="delay">10000</param>
<param name="delaySleepInterval">500</param>
</interceptor-ref>
<result name="wait" type="freemarker" >/dir/resources/First-Page.ftl</result>
<result name="error" type="freemarker" >/dir/resources/Error-Page.ftl</result>
<result name="success" type="stream">
<param name="contentDisposition">attachment; filename="${downloadFilename}"</param>
<param name="contentType">application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</param>
<param name="inputName">inputStream</param>
<param name="bufferSize">1024</param>
</result>
</action>
P.S: I haven't tested this code on million data sets. Test data consists of only few data.