BTW, I got it to work from the command line.

c:\Program Files\Microsoft Office\Office\Excel
"http://nagoya.apache.org/bugzilla/showattachment.cgi?attach_id=2551&bill_ga
tes=dummy.xls"

I used 'bill_gates' as a dummy parameter :)

If you drop off the &bill_gates=dummy.xls, (which means nothing to
bugZilla), you get an error page.


-----Original Message-----
From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 10:51 AM
To: POI Users List
Subject: Re: IE loads Excel-Sheet twice

Right, the problem is that some versions of IE ingore the mime type
entirely.  They use the file extension.  Which is in this case
".xls?parameter1=1&parameter2=2" so they need to read part of the file.


If you do

/path/to/reports/parameter1/value1/parameter2/value2/bla.xls then the
extension will match, it probably won't read the header.  Some folks have
had luck with a fake parameter on the end &myfile.xls in the first case, but
I never did.

-Andy

On 7/22/03 9:28 AM, "Christoph Jaeger" <[EMAIL PROTECTED]> wrote:

> Yes, I set the mime type to application/vnd.ms-excel. Additionally the
> request looks like
> "/path/to/reports/report.xls?parameter1=1&parameter2=2", where
> /path/to/reports/* is mapped to my Excel sheet producing servlet. I
> think I found out that with this combination it works* for IE (which
> seems to ignore the mime-type) AND other browsers (which respect the
> mime-type the servlet specifies).
>
> * "Works" of course with the exception of cases where IE sends two
> requests to load the file.
>
> One more thing I found out: this loading Excel sheets twice problem
> seems to happen less often for request where my servlet sends the header
> earlier (response.setContentType(...)):
>
> ...
> HSSFWorkBook wb=new HSSFWorkBook();
> // fill workbook, create lots of rows and cells
> reponse.setContentType("application/vnd.ms-excel");
> wb.write(response.getOutputStream());
> ...
>
> produces the problem more often than:
>
> ...
> reponse.setContentType("application/vnd.ms-excel");
> HSSFWorkBook wb=new HSSFWorkBook();
> // fill workbook, create lots of rows and cells
> wb.write(response.getOutputStream());
> ...
>
> Best Regards,
>
> Christoph J�ger
>
>> -----Original Message-----
>> From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, July 22, 2003 2:59 PM
>> To: POI Users List
>> Subject: Re: IE loads Excel-Sheet twice
>>
>>
>> You are setting the mimetype to application/vnd.ms-excel (or
>> something very
>> close to that...I forget the exact string)?
>>
>> I always found that the different buggy versions of IE worked
>> best when I
>> mapped *.xls to a servlet, used the /folders/as/parameters
>> and passed the
>> mime type.
>>
>> Each release of IE and Office has different strange bugs when
>> used in combo.
>> Its pretty odd that Excel works better with Netscape and Mozilla!
>>
>> -Andy
>>
>> On 7/22/03 2:54 AM, "[EMAIL PROTECTED]"
>> <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> 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_i
>> d=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]
>>>
>>>
>>>
>>> ---------------------------------
>>> Do you Yahoo!?
>>> SBC Yahoo! DSL - Now only $29.95 per month!
>>>
>>>
>>>
>>>
>>> This communication is for informational purposes only.  It
>> is not intended
>>> as
>>> an offer or solicitation for the purchase or sale of any financial
>>> instrument
>>> or as an official confirmation of any transaction. All
>> market prices, data
>>> and other information are not warranted as to completeness
>> or accuracy and
>>> are subject to change without notice. Any comments or
>> statements made
>>> herein
>>> do not necessarily reflect those of J.P. Morgan Chase & Co., its
>>> subsidiaries and affiliates.
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>>
>>>
>>> This communication is for informational purposes only.  It
>> is not intended as
>>> an offer or solicitation for the purchase or sale of any
>> financial instrument
>>> or as an official confirmation of any transaction. All
>> market prices, data
>>> and other information are not warranted as to completeness
>> or accuracy and
>>> are subject to change without notice. Any comments or
>> statements made herein
>>> do not necessarily reflect those of J.P. Morgan Chase & Co., its
>>> subsidiaries and affiliates.
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>> --
>> Andrew C. Oliver
>> http://www.superlinksoftware.com/poi.jsp
>> Custom enhancements and Commercial Implementation for Jakarta POI
>>
> http://jakarta.apache.org/poi
> For Java and Excel, Got POI?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


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


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

Reply via email to