File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes res.setContentType( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "res.setContentType("text/xml");" Watch "res.setContentType("text/xml");" New topic


kevin gutch

Joined: Sep 06, 2001
Posts: 3
I have an app that uses res.setContentType("text/xml");
It works fine in IE 5.5 + and Opera but does not wok in
Netscape (4.7+).
It just seems to ignore my res.setContentType. Any ideas?\

Kevin R. Gutch

Kevin R. Gutch
namita pa
Ranch Hand

Joined: Sep 06, 2001
Posts: 56
may be some of the closing tags are missing
check out
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

It depends on what you mean by "doesn't work". My copy of Netscape has no MIME definition for XML, so if you serve me up a text/xml, it will simply attempt to save it to a local file, not display it in the browser. IE5, on the other hand has a special MIME handler that sends the XML through an internal XSLT processor and activeX so it can do that neat little expanding-outline trick and color the text. I don't know what Opera has in it.

An IDE is no substitute for an Intelligent Developer.
kevin gutch

Joined: Sep 06, 2001
Posts: 3
I do not believe it is a Mime-Type problem.
I have seen that before (i.e. depending on the Opera settings it will either prompt for download or display on screen).
My code actually does nothing. When the button to download my file is clicked it linlks to another page that onLoad activates a servlet that conducts the Mime type.
I am getting to the page but nothing occurs after that.
As I said it works in IE 5.5 ad Opera.

I agree. Here's the link:
subject: res.setContentType("text/xml");
It's not a secret anymore!