java 如何在 Spring MVC 中使用 Comet?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4456357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I use Comet with Spring MVC?
提问by leedm777
I'd like to add some Comet/server pushcapabilities to a simple web application. I'm having trouble finding up to date information on how to do this.
我想向一个简单的 Web 应用程序添加一些Comet/服务器推送功能。我无法找到有关如何执行此操作的最新信息。
Can anyone point me to some examples, tutorials, blogs, or anything recent that walks you through using Comet with Spring MVC?
谁能给我指点一些示例、教程、博客或任何最近引导您使用 Comet 和Spring MVC 的内容?
In case it matters, I'm using Freemarkerto render the views, and JQueryfor the JavaScript framework.
以防万一,我使用Freemarker来呈现视图,并使用JQuery来呈现JavaScript 框架。
Aside:I already know all about Liftand its awesome Comet support built-in. This app is a proof of concept that I've already implemented using Lift. Now I'm building it with Spring MVC to compare and contrast.
旁白:我已经完全了解Lift及其内置的出色 Comet 支持。这个应用程序是我已经使用 Lift 实现的概念证明。现在我正在用 Spring MVC 构建它来进行比较和对比。
Edit:I've started trying out DWR. It's not fantastic, but I can make something that works. I also checked out Atmosphere, but I couldn't get any traction with it at all.
编辑:我已经开始尝试DWR。这不是太棒了,但我可以做出一些有用的东西。我还检查了Atmosphere,但我根本无法获得任何牵引力。
I'm leaving the question open. Hopefully some better suggestions will come in.
我将问题悬而未决。希望有更好的建议出现。
采纳答案by Bozho
Atmosphere is really the best I've seen (I haven't used any, but I've evaluated multiple solutions). The good thing with it is that it uses the best mechanism available. If running on servlet 3.0 - using the async support. If using jetty - using its support, and so on. It also has spring integration.
气氛真的是我见过的最好的(我没有使用过,但我已经评估了多种解决方案)。它的好处是它使用了最好的机制。如果在 servlet 3.0 上运行 - 使用异步支持。如果使用码头 - 使用它的支持,等等。它还具有弹簧集成。
So, perhaps you should ask a concrete question about atmosphere. See thisand thisrelated questions.
回答by jmarranz
Try ItsNat Comet, Spring can be used for setting up your application (contact with me if you don't know how you do so) but Spring MVC is not used.
试试ItsNat Comet,Spring 可以用来设置你的应用程序(如果你不知道怎么做,请联系我)但不使用 Spring MVC。