This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Setting response header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Setting response header" Watch "Setting response header" New topic

Setting response header

Ludmila Snova

Joined: Aug 31, 2006
Posts: 20
Hi all,

This site really helped me to pass my certification exam and I hope to get some help with issue I have been struggling the second week.

I am streaming the different types of files (PDF, DOC, and XML) and open them directly in the browser. The requirement is to keep the original name of the file, if user wants to save the opened file using the standard browser menu File-> Save As. In my java code, I set the following response header:

res.setHeader("Content-Disposition", "inline; filename=" + filename + ";");

It should work and it works fine with Mozilla Firefox, but it does not work with IE. I tried different combination of headers and quotation marks. Nothing is working for IE. I read that some versions of IE do not work properly with Content-Disposition header.
Is there some workaround for this? Please, help.

I agree. Here's the link:
subject: Setting response header
It's not a secret anymore!