IE does not do a HEAD request because it is checking to see that the file is
really an Excel file. To do so, it must examine some part of the header. A
HEAD request does not allow IE to examine the file contents.

BTW, IE often uses a GET request where you would expect a HEAD request. I
think someone decided it is faster to just do a GET, and simply close the
connection if the HTTP headers indicate that the client's cache is up to
date.

The bit of time is because once IE determines that the file is indeed Excel,
it launches Excel as an In-Process OLE server. If you monitor on the client
end, you can see that the behavior happens all the time (or at least almost
all the time). But oftentimes your servlet may not see it, because of
various caching.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 2:54 AM
To: [EMAIL PROTECTED]
Subject: RE: IE loads Excel-Sheet twice


You might well be right - but that only intensifies the mystery :

- why doesn't it send a 'HEAD' request? (i sniffed the packets - the
requests are almost identical GETs), and

- why does it only do that after a bit of time? it certainly doesn't happen
on quick responses! and it doesn't seem to make the second request if a
huge file is sent back straight away, but still does it if a tiny file
takes a while... that's what led me to think it was some sort of a time out


[EMAIL PROTECTED]
                      e.net                    To:
[EMAIL PROTECTED]
                                               cc:
                      22/07/03 03:54           Subject:  RE: IE loads
Excel-Sheet twice
                      Please respond to
                      poi-user

You are mis-interpreting the reason for the double download. It has nothing
to do with a timeout.

The first download is from IE, which examines the header of the file to
determine that the file really contains an Excel spreadsheet.

The second download is from Excel itself, which may be embedded inside IE
or
launched in a separate window (it depends on registry settings).

You will not get the double download if you open directly in Excel. (Did
you
know you can go into Excel, choose File | Open from the menu bar, and type
in a URL like
http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=2551). In
this situation, the file gets downloaded only one time.

Here is something that I can't figure out. It should work from the command
line as well. (Open a command window and give the command

c:\Program Files\Microsoft Office\Office\Excel
"http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=2551";

This should work but actually downloads an error page. Probably because
Excel actually asks for
"http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=2551.xls";
which Bugzilla does not understand.

None of this trivia is really very important. But it may help you to
diagnose problems. One thing to consider - the first download may not
consume the entire output stream. IE closes the first download as soon as
it
determines that the file is valid for Excel. Another thing - IE and Excel
will often ignore whatever you have set for mime type. It determines that
the file is Excel by examining the output stream header. And the last thing
to consider is that you may not always get a double download. For example,
I
gave two methods of opening an .xls over the web (directly from Excel) and
neither will cause the double download.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, July 21, 2003 11:03 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: IE loads Excel-Sheet twice


I have indeed seen this behaviour - IE has some internal timeout which it
reaches on longer operations and then 'cleverly' tries to get it again...

However, there are no simple ways of solving it, i've personally done it in
a completely async way (which might be a bit of an overkill), where browser
polls the page for the export, which performs the export in a threaded
manner, and only attempts to return the big file once it's ready.

so, simplified:

1.
start exporting the file in a thread, get it's id and return that to the
browser with aim to refresh:
i.e
<meta http-equiv="Refresh" content
="15,url=my_export_generator.jsp?taskId=123">

2.
then in your jsp, just check if your thread's done (maybe saved its details
in some cache), if it is, simply return the content... if not.. go back to
step.1

- this way you give ie no chance of making you start the export twice,
(unless it takes a very long time to do step 1)

... hope that helps...

                      [EMAIL PROTECTED]
                      .com                     To:
[EMAIL PROTECTED]
                                               cc:
                      21/07/03 15:33           Subject:  Re: IE loads
Excel-Sheet twice
                      Please respond to
                      poi-user

For some reason IE sends a request twice. It was something I ran into as
well, however, I never ran into an issue where session variables were
unaccessible. So I have no idea what that could be.

Christoph Jaeger <[EMAIL PROTECTED]> wrote:Hi,

I apologize if this is a bit off topic, but I thought someone on this
list may have experienced the same problems and found a solution
already.

I use POI to generate reports from a database. POI is used in a servlet,
which serves the Excel sheet to a web-browser.

Everything is fine for small sheets (several hundred to a few thousand
rows). The result is just as expected. But when I try to do a bigger
query (say, 7000 rows) IE behaves strangely: first a request is sent to
the server to generate the Excel file. This file is downloaded (as it
seems), but when the next page comes up in IE, showing Excel, the Excel
program sends a second request to load the sheet. This time, the session
information (included in a cookie) is "forgotten", and so the query does
not work (does only work for logged in users, but without session
information I can not determine the user).

The same thing works without any problems on my Linux box using Galeon
as a web browser (and Gnumeric or Open Office to view the Excel sheet).

Has anyone on this list already experienced a similar problem?

Thanks a lot,

Best Regards,

Christoph J�ger





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to