473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
6 1927
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
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

"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

"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
"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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: W.Guerlich | last post by:
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...
27
by: Curious Angel | last post by:
I have a resume in PDF format and I want anyone who LEFT-OR-RIGHT clicks the link to force the file to be saved, and in any event _not_ opened. Since the PDF will be in his cache in any event, I...
28
by: Act | last post by:
Why is it suggested to not define data members as "protected"? Thanks for help!
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
5
by: Paul Sullivan | last post by:
We are a state agency that views protected medical information via our intranet. The screens even have privacy shields. Alarmingly, uses can "Print" and "Save As" which destroys the protection of...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
6
by: Ryan | last post by:
I have a windows form that I want to force validation on controls (text boxes) when the user clicks a "Save" button. The only way I've found to do this is to cycle through every control and call...
8
by: asenthil | last post by:
Hai to all, if i'm having a file named as "tab.doc" which is a microsoft word document file ... i want to save it as another file as "tab1.doc" by using "save as" method.... Is there...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.