File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Servlet - POI - Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Servlet - POI - Excel" Watch "Servlet - POI - Excel" New topic

Servlet - POI - Excel

Marshall B Thompson
Ranch Hand

Joined: Apr 11, 2002
Posts: 42
I have a servlet running under Sun Java Web Server 6.1 that uses the apache POI library to create an excel spreadsheet, then stream it back to the browser . This works fine unless the servlet takes more than 60 seconds to do it's processing. If it takes more than 60 seconds, the excel is never served to the browser. However; I know the servlet finishes successfully with no errors. (I have logging enabled.) I can't find any web server settings or defaults that would seem to control this. Is this a client browser thing? It happens with both IE and FireFox.
Marshall B Thompson
Ranch Hand

Joined: Apr 11, 2002
Posts: 42
This happens with both IE and Firefox as the browser. I've tried several things, none of which solve d the issue: excel is not returned to browser if processing server-side takes more than 60 seconds.

Things I tried:
1. Set response headers first. I set content type, but I can't set content length until I create the spreadsheet (takes 60+ seconds). No luck.
2. add a cookie every 10 seconds or so, hoping that would somehow keep the connection alive. No luck.
3. Saved the excel to server file system before streaming it back to browser, does not solve the time issue.
4. I wrote my own client that connects via http to the url that would return an excel, it has the same 60 second issue.

Elsewhere have seen suggestions that setting content length up front is the way to go. But, I don't know the content length until I spend the 60+ seconds creating the content.

I may have to resort to having the user enter their email address on the web page and mailing the excel to them when it is finished. Most requests take a few seconds, the 60+ second request is an exception.
I agree. Here's the link:
subject: Servlet - POI - Excel
It's not a secret anymore!