jQuery in Action, 2nd edition*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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 !
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Streaming xlsx file in a servlet
 
Similar Threads
Opening an Excel file
session timeout
xlsx file name problem in internet explorer
How to read .xlsx sheet from Client Side using poi 3.5
FileUpload exception