This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Setting response header" Watch "Setting response header" New topic
Author

Setting response header

Ludmila Snova
Greenhorn

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.setContentType(Mimetype);
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.

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Setting response header
 
Similar Threads
Page cannot be displayed issue in jsp
Downloading file from server
Cannot open PDF directly, save works
urgently needed help
Not able to view popup to save xls file(in IE7), writing file into servlet response.