I am writing a
servlet that locates a document based on a
string sent as a request parameter. Based on this string, I create an input stream to the document and write the resulting byte[] array to the response's output stream. I also determine the Mime Type and set that in the request.
The issue that I am having is that when I attempt to run the servlet in IE, I get an error the first time I run it in a particular instance of IE (but it works fine after the first try). Debugging the code, I noticed that the first time I run the servlet, I begin with 0 Headers in the response object with a count of 0. After I get the Session from the request object, there become 3 Headers in the response object that are all initialized with a count of 3. When I set the content type, a fourth header is added and when I write the output stream, a fifth is added, bringing the count to 5.
In subsequent runs (same IE instance), before I get the Session from the request, there are already 5 headers, but all are zeroed out and the count is 0. After I set the Content Type, the first header gets initialized and when I write the output stream, the second header gets initialized and the count becomes 2. I was wondering if anyone could help me determine why this occurs and how to prevent it in the future. The IE error message I get is that IE could not download 'filename' from 'servername'.
If it helps, this doesn't happen when trying this on Firefox and it also doesn't happen when viewing image files (tiff/jpg/etc.)
[ October 12, 2004: Message edited by: Andrew Esse ]