使用 Java 在开放通道上使用 XML 推送数据源
我正在寻找一些示例 Java 代码和/或实用程序库,用于通过 http 消费 XML 推送数据源。
我已经知道如何使用 XStream 和 STax 来使用和解析基本的 XML feed。也就是说,我可以通过 http 发送 XML 请求,获取 xml 响应并对其进行处理。
不过,我可以选择订阅数据源。连接保持打开状态,服务器将任何新数据推送到通道上。然后,我需要在任何数据可用时对其进行处理。
我可能可以自己弄清楚,但最好还是看一些例子。我认为这种数据订阅订阅会相当普遍。但我似乎找不到任何例子。也许我只是搜索了错误的关键词?
如果有人知道用于通过 http 消费推送 xml 数据源的 Java 框架/实用程序和/或示例代码,我将不胜感激。
谢谢。
I am looking for some example Java code and/or utility library for consuming an XML push data feed over http.
I already know how to consume and parse a basic XML feed using XStream and STax. That is - I can send an XML request over http, get an xml response back and process it.
However, I have an option to subscribe to a data feed. The connection is kept open and the server pushes any new data onto the channel. I then need to process any data as it becomes available.
I can probably figure it out on my own, but it is always better to see some examples. I thought that this kind of data-feed-subscription would be fairly common. But I can't seem to find any examples. Maybe I am just searching on the wrong key words?
I would appreciate it if anyone knows of a Java framework/utility and/or example code for consuming a push xml data feed over http.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTTP 推送并不是一个真正定义明确的术语,有多种方法可以实现它。最好的方法是使用适当的客户端(无论是 comet、网络套接字、HTTP 流还是其他)并查看它提供什么样的接口。可能有一种简单的方法可以将现有的 XML 解析器连接到它。
HTTP push isn't really quite defined term and there are several ways to do it. Best approach is to use appropriate client (be it comet, web-sockets, HTTP streaming or whatever) and see what kind of interface it provides. There will probably be an easy way of connecting you existing XML parser to it.