您的位置: 新闻频道 AJAX新闻

原创新闻 DWR支持Grizzly Comet框架的补丁

2007-11-26 by 见习编辑 robbin
评论(1) 有996人浏览 dwr grizzly
Jean-Francois Arcand编写了一个DWR的补丁,可以让DWR的用户通过Reverse Engine来使用Grizzly Comet框架了。Grizzly真的是现在非常火爆的Java AJAX异步调用服务器端框架。

因为DWR也支持Jetty Continuations实现的异步调用,Jean-Francois Arcand比较了两种实现方法:

通过Jetty Continuations挂起连接:

Continuation continuation = ContinuationSupport.getContinuation(request, mutex);
continuation.suspend(timeout);


通过Grizzly挂起连接:

CometContext ctx = CometEngine.getEngine().register("DWR");
  CometHandler continuationHandler = new CometHandler() {
        public void attach(Object o) {
        }
        public void onEvent(CometEvent cometEvent) throws IOException {
        }
        public void onInitialize(CometEvent cometEvent) throws IOException {
        }
        public void onInterrupt(CometEvent cometEvent) throws IOException {
        }
        public void onTerminate(CometEvent cometEvent) throws IOException {
        }
    };
  ctx.setExpirationDelay(sleepTime);
  ctx.addCometHandler(continuationHandler);


Jean-Francois Arcand认为虽然Grizzly的实现方法略微复杂一些,但是Grizzly可以通过CometHandler在连接之间共享信息,要比Jetty Continuations功能强大,程序员有更多的控制能力。

也许我们应该多多关注Grizzly了。

评论 共 1 条 发表评论

hantsy 2007-11-27 10:09
Glassfish现在是硕果累累啊

发表评论

您还没有登录,请登录后发表评论