On 7/10/06, Thomas Joseph <[EMAIL PROTECTED]> wrote:
Hi all,
I have got a strange problem. My action class generates PDF, and writes on
the the response and fushes it, but I can see that this action is getting
called multiple times (2-5 times). I have cheked my struts-config to be just
perfect (No forwards)
The culprit could be the browser, especially MSIE.
The brain-dead way that MSIE used to work (three years ago, when I had to
investigate this) goes like this:
1) The user clicks on the browser to request the file.
2) The server sends the file back.
3) The browser reads the first 100 bytes or so to determine the type.
4) Once the browser determines that it is a PDF file, it discards the bytes
it has already read and the rest of the file.
5) The browser *on its own, without user intervention* requests the file again.
6) The browser hands the received file to the helper plugin or application.
In fact, some versions of MSIE were even more stupid, and requested the file
three times. It was so bad that Microsoft published the incredibly convoluted
logic MSIE followed trying to figure out the content type of byte streams, but
even then MSIE showed that the publication was not always accurate.
Try using different browsers and take note of any difference in behavior.
What can you do? First, always set correctly the "Content-Type" response
header. Second, if you can, play games so that the request from the
browser looks like "http://blahblah/.../moreblah.pdf". If the URL ends
in ".pdf",
MSIE will be more likely to do the right thing the first time.
Otherwise, just learn to live with it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]