How IE handles PDFs
From the Struts User Mailing List, I spotted a good explanation of how IE handles PDFs. It's quite messed up, so I thought I'd post it for your amusement.
If
your application returns data that is to be handled with an ActiveX
control (ie Adobe Acrobat Reader) the browser sends additional
requests to the server. In IE 4.x and 5 it actually sends three
requests. For IE 5.5+ it sends two.
Assuming that your using IE 5.5+, the first request is the original
request (duh), but then IE sends a second request to get the
content-type. Who knows why they can't figure this out on the first
request This second request has it's userAgent header set to
"contype". You can solve this problem and increase the performance of
your application by writing a Servlet filter that sits in front of
whatever Actions you have setup to serve PDF content. Have this
filter look at the userAgent header of each request. If it's set to
"contype" just send an an empty response back to the client with the
content type set to "application/pdf". Simple as that.
More info on this "feature" is on Microsoft's site.
Posted by David Carter on March 24, 2005 at 12:41 PM MST #
Posted by Keller on March 26, 2005 at 12:26 AM MST #