I have an RSS link on my page that is actually a reference to a servlet that outputs xml that should be treated as RSS. What’s happening is that it loads the servlet and it simply displays the XML in the browser. Usually this is taken care of because you’d link your RSS file as a “whatever.rss” but in this case it’s a servlet serving it up. How can I tell the browswer that it should be viewed as a .rss? Can a servlet load a page with an extension? or is there a contentType(“rss/xml; charset=UTF-8”); similar type tag that can just be set directly in the servlet?
Thank you,
You can get what you want by calling the
secContentType()method on your ServletResponse object in your servlet. Something like:That should be all you need.