Atom feed基础知识

问题描述:

我想提供一个atom feed。直接与response.getOutputStream().write(message.getBytes());与消息是上面的字符串Atom feed基础知识

<?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> 

我在写这个东西:我的HttpServlet写下面的东西(*复制)。

在Internet Explorer中打开了一个特殊的feed阅读器页面,但使用firefox显示了raw xml。

这是一个Firefox的问题,还是我错过了一些编码,标题,MIME类型或其他信息,所有浏览器看到一个原子来了?

您需要设置正确的内容类型,对于Atom是application/atom + xml,因为这是您的浏览器用来决定要启动的插件或应用程序的内容。

+0

不错1.作品广告。 –

您是否为您的原子提要使用了正确的响应标题。您需要在响应头中设置“Content-Type:application/rss + xml”,才能在Firefox中正常工作。

+1

这是正确的想法,但错误的媒体类型 - 请参阅下面的答案。 –