The double-download is unavoidable AFAIK. The reason is that IE does
not believe the server header for mime type. It double checks by
downloading the file header. I think it only downloads the front
part of the file. Maybe only the first 512 bytes. According to
a Microsoft article I read, this is a feature. It allows IE to
launch Excel (or Word, PowerPoint, or any other Office tool) even
on ISPs that do not support the custom mime types, which would be
the standard way of telling a browser what type of file is being
downloaded.

The second download would be from Excel. Excel would not know about
the cookies you are probably using to identify the user session, so
it looks like a new session in the log.

You cannot prevent the double-download (I don't think). But you can
make the second download part of the session. Just send the URL through
HttpSession.encodeUrl().

-----Original Message-----
From: Reto Badertscher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 6:05 AM
To: POI Users List
Subject: AW: POI and JSP


Hello,

i do it similar as described. Additionally I add a header as follows:
 response().addHeader("Content-disposition", "attachement; filename=" +
file.getName());

The file will be opened by IE, but in a new session. When looking at my logs
i have 2 requests for a download:
1. From the user who requested the file and has already a session and is
identified
2. The same request in a new session

The
URL:/server/app/control?action=dir_browser_download&user=1&area=download&fil
e=test.xls


Does anyone knows why this happens and how to prevent it

Thanks

Reto

-----Urspr�ngliche Nachricht-----
Von: Danny Angus [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 22. Mai 2002 10:36
An: POI Users List; Ferruccio Spagna
Betreff: RE: POI and JSP


> The only problem is now that IExplorer
> doesn't open Excel automatically (Netscape does), or can I do
> something for
> this? I tried to stream to the client an xls from a servlet that specifies
> the content-type without having better result.

1/ set content-type to "application/x-excel"
2/ make your link end with .xls EG:
http://mysite.com/context/servlet/org.apache.test/x.xls?param=value

This works, M$IE recognises "x.xls" as an excel file, and tomcat will call
org.apache.test.doGet(), and pass in the parameters correctly, to generate
it.
M$IE opens Excel in a COM in-browser process.
You can also use the URL in the File->open dialogue of Excel to open the
generated xls file directly without using IE.

d.


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


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


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

Reply via email to