Cometd is a scalable HTTP-based event routing bus that uses a Ajax Push technology pattern known as Comet. The term 'Comet' was coined by Alex Russell in his post Comet: Low Latency Data for the Browser.
The Plugin setup a Cometd servlet and includes all the demo programs from the original Cometd distribution.
该插件建立了一个Cometd servlet并包含所有原来Cometd版本的例子程序。
compatibility note The cometd demo works in any version. but there is a bug that caused the Cometd Servlet to fail when any Grails controller is added to the project. Please use Grails 1.1 RC1 or later for Grails development.
compatibility note The cometd例子在任何版本下都有效。但有一个小问题,当任何Grails controller 添加到工程时,Cometd Servlet会引起失败。请使用Grails 1.1 RC1或更新版本。
特点:
- included everything from the cometd distribution, including all libraries and demo programs.
- With two additional classes for 'bridging' Cometd and the Spring-based Grails
- 使用2个额外的类作为桥接Cometd和基于 Spring的 Grails
- SpringCometdServlet
- extends ContinuationCometdServlet
- it is created to skip the init() method in AbstractCometdServlet that load the init-parameters from web.xml. This implementation loads the parameters from Spring configuration instead.
- filters are not loaded from a json file, but is also defined in Spring configuration. (remarks: this feature is not properly tested !)
- SpringBayeux
- A singleton bayeux instance is the core Bayeux server component
- SpringBayeux extends ContinuationBayeux
- The SpringBayeux is expected to be constructed in Spring before the initialization of servlet context.
- 动态增加servlet and servleting mapping,在spring中创建一个单例的Bayeux
Dynamically adding servlet and servleting mapping, and create a singleton Bayeux in Spring
-
- Servlet mapping
- 默认的, the Cometd servlet are mapped to *.cometd, /cometd, /cometd/*, and /plugins/cometd-${version}/cometd (for running the demo programs 目的是运行 示例程序)
- the 'cometd' namespace is configurable with 'cometd.namespace' system property
- the 'cometd' namespace是可以配置的,位于系统属性中的'cometd.namespace'。
- Spring
- The Bayeux instance is named 'bayeux' in Spring's application context
用法
For non-Grails users, download a Grails binary distribution and setup environmental variables according to the Grails installation procedure, then run the following commands to create your Cometd project and access the demo:
- grails create-app ${applicationName}
- cd ${applicationName}
- grails install-plugin cometd
- grails run-app
- 访问示例位置:access the demo at http://localhost:8080/${applicationName}/plugins/cometd-${pluginVersion}/
- 自0.1.2版本起,如下配置是可用的。from 0.1.2, the following configurations are available:
· plugins {
· cometd {
· 'servlet-mapping' {
· namespace = 'cometd'
· }
· 'noCacheFilter' {
· disable = false; //the filter add HTTP Header for disabling HTTP cache
· }
· 'cometdService' { // Cometd provides extra functions including logging and client tracking
· disable = false; // disable
· }
· }
· }
- 系统属性不再支持System property is no longer supported.
- 日志logging
debug consoleAppender: 'org.grails.plugins.cometd'
发送和接收消息与cometd channels
send and receive message to/from cometd channels
- 一个名为'bayeux'的spring bean,它代表Cometd server,你将在你的应用程序中和他交互
- a Spring bean named 'bayeux' which represents the Cometd server and you will interact with it in your application
o class MyChatService{
o def bayeux
o }
- 服务端接收消息receiving message at the server side
- 服务端发送消息sending messaege at the server side
版本与兼容性
- 版本 0.1.*
- 支持 Grails 1.1 RC1 for Grails开发
- 包含 cometd-jetty 6.1.12 / cometd-api 1.0beta4
- 该插件使用cometd-jetty, quote from the cometd mail list:
- "Note that the jetty cometd servlet will run on tomcat. It just wont use the async features of tomcat, but it will still handle many hundreds of simultaneous users (good for many apps)."
链接
作者: Mingfai Ma (mingfai.ma (at-no-spam) gmail.com)
Close
近日弄个例子上来
分享到:
相关推荐
Grails Pjax插件Pjax在Grails中。 Pjax类似于(turbolinks)[ ,在'A'标签,按钮和表单上工作。 参见_pjaxHeader grails templtate文件中的演示代码。 ## Pjax是什么? Pjax是一个jQuery插件,它使用ajax和pushState...
eclipse插件、用来开发grails(路漫漫其修远兮、吾将上下而求索)
在help菜单选择Install New Software…
grails的插件系统也是其亮点之一。首先,和rails,django等web框架类似,基于微内核的思想,插件(可重用模块)是框架的一等公民。grails除了核心模块以外的功能几乎都是通过插件方式实现的。实际上,一个grails插件...
elasticsearch-grails-plugin, 恢复的ElasticSearch grails插件 Elasticsearch插件插件这个项目是一个基于Elasticsearch的插件,这个项目是基于的人完成的伟大工作的。你为什么想要为原来的Elasticsearch插件提供...
概括Grails插件将Primefaces集成到Grails项目中。 带有Java JDK 1.7的最低Grails版本是2.3.7,并且依赖项具有以下版本: 核心JSF 2.2 Primefaces 5.2 Apache MyFaces 2.2.8 可以在上找到源代码安装通过在BuildConfig...
grails-4.0.4.zip
eclipse插件grails(groovy)配置方法
本文内容包括:ShortenUrl插件简介创建TinyUrl类测试TinyUrl类创建IsGd类创建ShortenUrl服务打包并部署插件结束语下载参考资料在这个“精通Grails”系列中,ScottDavis将向您展示如何创建您自己的Grails插件。...
Grails Grails Grails Grails Grails
grails 中文文档+grails-fckeditor-0.9.5.zip插件
用于 Grails 框架的 MyBatis 插件 基于原始 Grails-iBatis 插件:Brian Sanders ( ) Grails 插件主页: : 修改: 命名约定的一些变化 添加了对多个数据源的完全支持 Grails 2.0 插件重构 最小 Grails 依赖项 ...
Grails插件实验 定义Grails 3.0插件域类是可扩展的 SO的详细信息: 该项目包含一个名为security的插件和一个名为bookstore的应用程序以测试该插件。 插件用户: org.centerkey.grails.User 应用程序用户(扩展...
这是一个Grails插件,可在Grails Web项目中使用Scala代码。 分配 grails-scala-.zip用于插件源分发-这是推荐版本,因为此插件的二进制版本不包含必需的jar 依存关系 使用的Grails版本要求的Servlet容器来运行Web应用...
Grails GWT插件介绍Google Web Toolkit (GWT) 是一种高级 AJAX 框架,允许您使用 Java 开发丰富的用户界面,从而利用类型检查和代码重用。 然后 GWT 将编译您的 Java 代码并生成可以包含在您选择的任何网页中的快速...
Grails AngularJS资源插件 该插件将资源添加到Grails应用程序中。 它使用Grails来优雅地处理资源。 只需让您的AngularJS资源(服务,控制器等)依赖于“ Angular”模块即可。 还有一个用于AngularJS场景测试的控制...
Grails Shiro UI 插件 请参阅。
s2oauth 适用于Grails 3的POC Spring Security + OAuth插件 Grails 2插件的主要区别: 不再依赖但该插件的一些代码已移植到此目前(没有)域类和数据库持久性最简单的代码储存库结构为了加快开发速度,有一个单独的...
Stylus Grails 资产管道Grails stylus-asset-pipeline是一个插件,它为资产管道静态资产管理插件提供支持。 大部分是从复制的有关如何使用资产管道的更多信息,请访问。 通过模拟 Node.js 的文件系统导入和需要工作...