Issue
I want to provide a atom feed. My HttpServlet writes the following stuff (copied from wikipedia):
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><author><name>Autor des Weblogs</name></author><title>Titel des Weblogs</title><id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id><updated>2003-12-14T10:20:09Z</updated><entry><title>Titel des Weblog-Eintrags</title><link href="http://example.org/2003/12/13/atom-beispiel"/><id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id><updated>2003-12-13T18:30:02Z</updated><summary>Zusammenfassung des Weblog-Eintrags</summary><content>Volltext des Weblog-Eintrags</content></entry></feed>
I'm writing this stuff directly with response.getOutputStream().write(message.getBytes());
with message being the string above.
In Internet explorer a special feed reader page is opened but with firefox the raw xml is displayed.
Is this a firefox issue, or am I missing to pass some encoding,header, mime type or other information that all browsers see that a atom is coming?
Solution
You need to set the correct content type, which for Atom is application/atom+xml because this is what your browser uses to decide what plugin or app to launch.
Answered By - Jan Algermissen
Answer Checked By - David Marino (JavaFixing Volunteer)