• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Headers, Mime Type, and Session

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd get out a packet sniffer and see exactly what the headers are as they are being sent across.

For firefox, this is easy to do with the live headers plugin, but for ie, you will need a packet sniffer.
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic