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

W

W.Guerlich

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.
 
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).
 
N

Nikolai Chuvakhin

(e-mail address removed) (W.Guerlich) wrote in message
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
 
C

Chung Leong

W.Guerlich said:
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?
 
S

Silvio Bierman

W.Guerlich said:
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
 
W

W.Guerlich

Silvio Bierman said:
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?
 
S

spalding

W.Guerlich said:
*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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top