GeeCON Prague 2014*
The moose likes Servlets and the fly likes Streaming xlsx file in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Streaming xlsx file in a servlet" Watch "Streaming xlsx file in a servlet" New topic
Author

Streaming xlsx file in a servlet

dwarakanathan thiru
Ranch Hand

Joined: Oct 14, 2009
Posts: 49
Hi All,

I have been using a common java file that streams contents in a specific file content type. I have used the code to open / save pdf file contents and small excel file contents.
Now, I am trying to dump a huge xlsx file which takes almost 30 minutes to download on our servers, but in my local server, it takes just half the time.

almost one out of 2 times, it also gets timed out (but no error is thrown on the screen), after 30 minutes or so.
Is the timeout related to session inactivity for 30 minutes because of the download that is happening which avoids the user interaction with the screen?

Which is the better option of the two to solve the timeout issue and to improve the performance?
1) Use a temporary file to store the data and then buffer the contents into the stream (This is the option currently in practice)
2) Write directly into the response output stream

Note: I am using POI to generate the xlsx

I appreciate any timely help in this regard.

Thanks!!


Thanks,
Dwarak T
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I believe, using GZIPOutputStream may resolve to a certain extent your time out issue.


S.D. MADHAN
Not many get the right opportunity !
 
GeeCON Prague 2014
 
subject: Streaming xlsx file in a servlet