- 浏览: 2539981 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Comet-Jetty(4)Read the Source Codes and Refactor the Project
1. Find resources
Install the source to my repository, then it is easy for me to read the source codes.
>mvn -DskipTests=true source:jar install
2. Create new Project easytalker/easycometd
easycometd will handle the page messages.
easytalker will handle the offline messages.
easyandroidspeaker will handle the android client in the feature.
The client Class will be as follow to support the private talk message:
public void go() throws InterruptedException {
String defaultURL = "http://localhost:8080/easycometd/cometd";
String url = defaultURL;
client = new BayeuxClient(url, LongPollingTransport.create(null));
client.getChannel(Channel.META_HANDSHAKE).addListener(
new InitializerListener(nickname, client, chatListener,
membersListener));
client.getChannel(Channel.META_CONNECT).addListener(
new ConnectionListener(nickname, client));
client.handshake();
boolean success = client.waitFor(2000, BayeuxClient.State.CONNECTED);
if (!success) {
System.err.printf("Could not handshake with server at %s%n", url);
return;
}
String text = "hello,where is the book";
Map<String, Object> data = new HashMap<String, Object>();
data.put("user", nickname);
data.put("chat", text);
client.getChannel("/chat/demo").publish(data);
Map<String, Object> pdata = new HashMap<String, Object>();
text = "hello,where is the money";
pdata.put("chat", text);
pdata.put("room", "/chat/demo");
pdata.put("user", "karl");
pdata.put("peer", "sillycat");
client.getChannel("/service/privatechat").publish(pdata);
for (int i = 0; i < 10; i++) {
Thread.sleep(5000);
}
data = new HashMap<String, Object>();
data.put("user", nickname);
data.put("membership", "leave");
data.put("chat", nickname + " has left");
client.getChannel("/chat/demo").publish(data);
client.getChannel("/service/privatechat").release();
client.getChannel("/chat/demo").release();
client.disconnect(3000);
}
3. Error Message Tips
Error Message
802 [HttpClient-13] INFO org.cometd.client.BayeuxClient.1188088890 - Messages failed [{id=7, connectionType=long-polling, channel=/meta/connect, clientId=33uitvf0nskcyrayr07o0zvdt}]
java.net.ProtocolException: Unexpected response 500: TransportExchange@2ae522a0=POST//localhost:8080/easycometd/cometd/connect#CONTENT(0ms)->COMPLETED(0ms)sent=23ms
at org.cometd.client.BayeuxClient$PublishTransportListener.onProtocolError(BayeuxClient.java:1161)
at org.cometd.client.transport.LongPollingTransport$TransportExchange.onResponseComplete(LongPollingTransport.java:324)
at org.eclipse.jetty.client.HttpExchange$Listener.onResponseComplete(HttpExchange.java:1153)
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:300)
SEVERE: Servlet.service() for servlet [cometd] in context with path [/easycometd] threw exception
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1664)
at org.apache.catalina.connector.Request.startAsync(Request.java:1657)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1023)
at org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:171)
at org.cometd.server.transport.LongPollingTransport.handle(LongPollingTransport.java:288)
at org.cometd.server.CometdServlet.service(CometdServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:212)
at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:179)
solution
There is solution to deal with tomcat7. Maybe only some configuration changes, but I just use tomcat6.x to run my project, it is ok now.
references:
1. Find resources
Install the source to my repository, then it is easy for me to read the source codes.
>mvn -DskipTests=true source:jar install
2. Create new Project easytalker/easycometd
easycometd will handle the page messages.
easytalker will handle the offline messages.
easyandroidspeaker will handle the android client in the feature.
The client Class will be as follow to support the private talk message:
public void go() throws InterruptedException {
String defaultURL = "http://localhost:8080/easycometd/cometd";
String url = defaultURL;
client = new BayeuxClient(url, LongPollingTransport.create(null));
client.getChannel(Channel.META_HANDSHAKE).addListener(
new InitializerListener(nickname, client, chatListener,
membersListener));
client.getChannel(Channel.META_CONNECT).addListener(
new ConnectionListener(nickname, client));
client.handshake();
boolean success = client.waitFor(2000, BayeuxClient.State.CONNECTED);
if (!success) {
System.err.printf("Could not handshake with server at %s%n", url);
return;
}
String text = "hello,where is the book";
Map<String, Object> data = new HashMap<String, Object>();
data.put("user", nickname);
data.put("chat", text);
client.getChannel("/chat/demo").publish(data);
Map<String, Object> pdata = new HashMap<String, Object>();
text = "hello,where is the money";
pdata.put("chat", text);
pdata.put("room", "/chat/demo");
pdata.put("user", "karl");
pdata.put("peer", "sillycat");
client.getChannel("/service/privatechat").publish(pdata);
for (int i = 0; i < 10; i++) {
Thread.sleep(5000);
}
data = new HashMap<String, Object>();
data.put("user", nickname);
data.put("membership", "leave");
data.put("chat", nickname + " has left");
client.getChannel("/chat/demo").publish(data);
client.getChannel("/service/privatechat").release();
client.getChannel("/chat/demo").release();
client.disconnect(3000);
}
3. Error Message Tips
Error Message
802 [HttpClient-13] INFO org.cometd.client.BayeuxClient.1188088890 - Messages failed [{id=7, connectionType=long-polling, channel=/meta/connect, clientId=33uitvf0nskcyrayr07o0zvdt}]
java.net.ProtocolException: Unexpected response 500: TransportExchange@2ae522a0=POST//localhost:8080/easycometd/cometd/connect#CONTENT(0ms)->COMPLETED(0ms)sent=23ms
at org.cometd.client.BayeuxClient$PublishTransportListener.onProtocolError(BayeuxClient.java:1161)
at org.cometd.client.transport.LongPollingTransport$TransportExchange.onResponseComplete(LongPollingTransport.java:324)
at org.eclipse.jetty.client.HttpExchange$Listener.onResponseComplete(HttpExchange.java:1153)
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:300)
SEVERE: Servlet.service() for servlet [cometd] in context with path [/easycometd] threw exception
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1664)
at org.apache.catalina.connector.Request.startAsync(Request.java:1657)
at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1023)
at org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:171)
at org.cometd.server.transport.LongPollingTransport.handle(LongPollingTransport.java:288)
at org.cometd.server.CometdServlet.service(CometdServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:212)
at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:179)
solution
There is solution to deal with tomcat7. Maybe only some configuration changes, but I just use tomcat6.x to run my project, it is ok now.
references:
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 288Hadoop Docker 2019 Version 3.2. ... -
Nginx and Proxy 2019(1)Nginx Enable Lua and Parse JSON
2019-12-03 04:17 437Nginx and Proxy 2019(1)Nginx En ... -
Data Solution 2019(13)Docker Zeppelin Notebook and Memory Configuration
2019-11-09 07:15 279Data Solution 2019(13)Docker Ze ... -
Data Solution 2019(10)Spark Cluster Solution with Zeppelin
2019-10-29 08:37 243Data Solution 2019(10)Spark Clu ... -
AMAZON Kinesis Firehose 2019(1)Firehose Buffer to S3
2019-10-01 10:15 313AMAZON Kinesis Firehose 2019(1) ... -
Rancher and k8s 2019(3)Clean Installation on CentOS7
2019-09-19 23:25 301Rancher and k8s 2019(3)Clean In ... -
Pacemaker 2019(1)Introduction and Installation on CentOS7
2019-09-11 05:48 333Pacemaker 2019(1)Introduction a ... -
Crontab-UI installation and Introduction
2019-08-30 05:54 442Crontab-UI installation and Int ... -
Spiderkeeper 2019(1)Installation and Introduction
2019-08-29 06:49 493Spiderkeeper 2019(1)Installatio ... -
Supervisor 2019(2)Ubuntu and Multiple Services
2019-08-19 10:53 363Supervisor 2019(2)Ubuntu and Mu ... -
Supervisor 2019(1)CentOS 7
2019-08-19 09:33 321Supervisor 2019(1)CentOS 7 Ins ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 365Redis Cluster 2019(3)Redis Clus ... -
Amazon Lambda and Version Limit
2019-08-02 01:42 432Amazon Lambda and Version Limit ... -
MySQL HA Solution 2019(1)Master Slave on MySQL 5.7
2019-07-27 22:26 507MySQL HA Solution 2019(1)Master ... -
RabbitMQ Cluster 2019(2)Cluster HA and Proxy
2019-07-11 12:41 456RabbitMQ Cluster 2019(2)Cluster ... -
Running Zeppelin with Nginx Authentication
2019-05-25 21:35 315Running Zeppelin with Nginx Aut ... -
Running Zeppelin with Nginx Authentication
2019-05-25 21:34 316Running Zeppelin with Nginx Aut ... -
ElasticSearch(3)Version Upgrade and Cluster
2019-05-20 05:00 321ElasticSearch(3)Version Upgrade ... -
Jetty Server and Cookie Domain Name
2019-04-28 23:59 389Jetty Server and Cookie Domain ...
相关推荐
里面东西很多,都是关于GWT-COMET的内容,实现gwt的服务器推技术,包括gwt-comet-examples-...gwt-comet-1.2.3.jar:jar包,gwt-example:聊天实例源代码(.java的),gwt-event-source-1.0.0.jar:comet事件源jar包。
在"comet-iframe.rar"这个压缩包中,可能包含了关于如何将PHPComet集成到IFrame中的示例代码、配置文件或者教程文档。这些资源可以帮助开发者理解如何创建一个可以实时更新的IFrame,以及如何配置PHPComet服务器来...
comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天
(Comet-)ATOMIC 2020:关于符号和神经常识知识图 纸 耶拿·黄(Jena D. Hwang),钱德拉(Chandra Bhagavatula),罗南·勒布拉斯(Ronan Le Bras),杰夫·达(Jeff Da),坂口圭介(Keisuke Sakaguchi),安托万...
在本文中,我们将深入探讨名为"unbabel-comet-0.0.1"的Python库,该库被封装在一个名为"unbabel-comet-0.0.1.tar.gz"的压缩文件中。 "unbabel-comet-0.0.1.tar.gz"是一个典型的源代码打包文件,它采用了tar格式用于...
atmosphere-flick-comet-0.2-m1-sources.jar
atmosphere-flick-comet-0.3.1-sources.jar
atmosphere-flick-comet-0.5.1-sources.jar
atmosphere-flick-comet-0.4-sources.jar
atmosphere-flick-comet-0.3-sources.jar
atmosphere-flick-comet-0.2-sources.jar
atmosphere-flick-comet-0.1-sources.jar
综上所述,这个压缩包包含的`comet4j.js`、`comet4j-tomcat6.jar`和`comet4j-tomcat7.jar`是实现基于Java的Comet4j实时通信框架的关键组件。它们分别负责客户端的JavaScript交互、在Tomcat服务器上的集成和支持,为...
科密点钞机升级操作指引教程,升级识别2015版人民币 WJD-Comet-A30 WJD-Comet-B329 WJD-Comet-C518 WJD-Comet-D629 WJD-Comet-KM2800 WJD-Comet-KM6800
Comet-For-MLFlow扩展 Comet-For-MLFlow扩展是一个CLI,可将MLFlow实验运行映射到Comet实验。 此扩展程序使您可以在Comet.ml UI中查看现有实验,该UI提供了对实验结果的经过身份验证的访问权限,大大提高了大批量...
【comet-jquery】是一种基于jQuery的实时通信技术,它利用了Comet技术来实现服务器向客户端推送数据的功能。在Web开发中,传统的HTTP协议是请求-响应模式,即客户端发起请求,服务器返回数据,而Comet技术打破了这种...
科密票据打印机官方驱动程序 COMET-CM-30是CM-30票据打印机的官方驱动,使用这款驱动能完美驱程COMET-CM-30的票据打印机,有需要的用户可以下载驱动程序安装。小编已经把win32位和win64位的驱动都打包在压缩包里,请...
科密票据打印机官方驱动程序 COMET-CK-300K是CK-300K打印机的专用驱动程序,能完美驱程COMET-CK-300K的票据打印机,有需要的用户可以下载驱动程序安装。小编提供了32位和64位的驱动,请用户根据自身系统选择对应的...
6.1.11) and replace the Jetty jar files in your grails installation. The files that I modified were: - jetty-6.1.x.jar - jetty-naming-6.1.x.jar - jetty-plus-6.1.x.jar - jetty-util-6.1.x.jar 3. ...
在实际使用Comet_ml时,首先需要通过pip安装:`pip install comet-ml`。然后,在项目开始时,引入comet_ml库并初始化实验,例如:`from comet_ml import Experiment; experiment = Experiment(api_key="YOUR_API_KEY...