By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

dynamic file download with *long* response time - How to show "Save As" early?

P: n/a
I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.

I want to show the "Save As" dialog as early as possible so the user
knows he's not lost and forgotten.

I already tried to send the response headers immediately after
receiving the request including content disposition and filename. Even
though the browser receives those headers it just won't trigger the
"Save As" dialog. This applies to both MS IE and Mozilla.

Any ideas appreciated.
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
ak
> I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.


for such long things you should redirect to some page which shows progress
of
your long operation (with JavaScript for example).

--
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader

Nov 18 '05 #2

P: n/a
gu******@t-online.de (W.Guerlich) wrote in message
news:<38**************************@posting.google. com>...

I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.


With this kind of response time, delivering the complete file
via e-mail seems to be a much better idea...

Cheers,
NC
Nov 18 '05 #3

P: n/a

"W.Guerlich" <gu******@t-online.de> wrote in message
news:38**************************@posting.google.c om...
I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.

I want to show the "Save As" dialog as early as possible so the user
knows he's not lost and forgotten.

I already tried to send the response headers immediately after
receiving the request including content disposition and filename. Even
though the browser receives those headers it just won't trigger the
"Save As" dialog. This applies to both MS IE and Mozilla.

Any ideas appreciated.


One of those times when the HTTP response code 100 is of use?
--
Obey the Clown - http://www.conradish.net/bobo/
Nov 18 '05 #4

P: n/a

"W.Guerlich" <gu******@t-online.de> wrote in message
news:38**************************@posting.google.c om...
I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content can be
delivered to the browser.

I want to show the "Save As" dialog as early as possible so the user
knows he's not lost and forgotten.

I already tried to send the response headers immediately after
receiving the request including content disposition and filename. Even
though the browser receives those headers it just won't trigger the
"Save As" dialog. This applies to both MS IE and Mozilla.

Any ideas appreciated.


That library keeps everything in memory until you close and write the
document. It is useless for large resultsets.

Use either tab/cr delimited data (which can be read by Excel as well) or
generate Excel XML as a stream. That last option is only good for Excel 2003
(2000 also supports a slightly different XML format).

Silvio Bierman
Nov 18 '05 #5

P: n/a
"Silvio Bierman" <sb******@jambo-software.com> wrote:
That library keeps everything in memory until you close and write the
document. It is useless for large resultsets.

Use either tab/cr delimited data (which can be read by Excel as well) or
generate Excel XML as a stream. That last option is only good for Excel 2003
(2000 also supports a slightly different XML format).


On another occasion I successfully used such a hybrid HTML/XML format
readable by Excel 2000. But this time the created Excel file must be
compatible with Excel 97. Even though Excel 97 supports some kind of
HTML format, too, it's not capable of preserving cell formatting.

Since the first couple bytes of each generated Excel file always seem
to be the same I thought about writing those bytes first and stripping
them from the generated document later.

From my observations I can tell that receiving the response header
will make the readyState-property (MS IE only) of the current window
go to "complete" for the browser then knows it's actually a file
download it is receiving.

But that still raises the question: What in the world makes the "Save
As" dialog appear?
Nov 18 '05 #6

P: n/a

W.Guerlich wrote:
*I've got a Java servlet that delivers large database resultsets
transformed to Excel with the HSSF library. In some cases it takes
more than 15 minutes before transformation is done and content ca
be
delivered to the browser.

I want to show the "Save As" dialog as early as possible so the user
knows he's not lost and forgotten.

I already tried to send the response headers immediately after
receiving the request including content disposition and filename
Even
though the browser receives those headers it just won't trigger the
"Save As" dialog. This applies to both MS IE and Mozilla.

Any ideas appreciated. *

Hi

Okay, I'm simply guessing here as my knowledge of Servlets is prett
basic;

I'm assuming you're streaming the contents as it's being transformed
If this is the case, you need to disable or flush the buffer as th
contents is written to the response object's output stream. Otherwise
the browser is still waiting for the content type header while th
contents is written to the stream, so it doesn't know what to do wit
the file
-
spaldin
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.