pushlet推送数据到页面
来源:互联网 发布:阿里云域名市场 编辑:程序博客网 时间:2024/06/05 16:53
1后台
package test.controller;import java.io.Serializable;import java.io.UnsupportedEncodingException;import nl.justobjects.pushlet.core.Event;import nl.justobjects.pushlet.core.EventPullSource;public class HelloWorldPushlet extends EventPullSource implements Serializable { private static final long serialVersionUID = -4378845831200885879L; /** * 推送时间间隔 */ protected long getSleepTime() { return 1000; } /** * 推送时所触发的方法 */ protected Event pullEvent() { //创建事件,并制定事件的主题 Event event = Event.createDataEvent("/fxh/helloworld"); String data = "hello world,microbingbing" + System.currentTimeMillis(); try { data=new String(data.getBytes("UTF-8"),"ISO-8859-1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } event.setField("message", data); return event; } }
2sources.properties
source3=test.HelloWorldPushlet
3页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>抽取记录</title><meta http-equiv="content-type" content="text/html; charset=UTF-8"><script type="text/javascript" src="${contextPath}/main/assets/js/jquery.js"></script><script type="text/javascript" src="${contextPath}/main/assets/js/pushlet/ajax-pushlet-client.js"></script><script type="text/javascript"> // PL._init(); PL.joinListen('/fxh/helloworld'); //事件标识 在数据源中引用 function onData(event) { console.log(event.get("message")); }</script></head><body></body></html>
0 0
- pushlet推送数据到页面
- pushlet 服务器主动推送数据到客户端
- pushlet 服务器数据推送到客户端
- java web服务器推送数据到客户端(pushlet)
- pushlet实现服务端推送消息到浏览器
- pushlet实现服务端推送消息到浏览器
- 开源框架Pushlet入门,使用Pushlet将消息从服务器端推送到客户端
- Pushlet 推送数据库消息到前台指定用户
- 使用Pushlet将消息从服务器端推送到客户端
- 使用Pushlet将消息从服务器端推送到客户端【
- Pushlet初级Demo1 - 服务端自动推送到客户端
- 使用Pushlet将消息从服务器端推送到客户端【原创】
- 使用Pushlet将消息从服务器端推送到客户端
- 使用Pushlet将消息从服务器端推送到客户端
- 使用Pushlet将消息从服务器端推送到客户端【原创】
- Pushlet实现消息从服务器端推送到客户端
- pushlet定时推送
- pushlet主动推送
- ubuntu系统如何中安装搜狗输入法
- 关于文件加密的思考
- Android 系统开发常用的目录(崩溃日志/wifi密码等)
- Lint使用心得
- NOIP2016普及组第二题——回文日期
- pushlet推送数据到页面
- js中cookie
- nginx常用超时设置
- NSG2-一个很好用的ns2的tcl脚本自动生成软件
- iOS开发支付宝支付
- Delay Line VT Drift Detection and Compensation
- 如何直接访问CImage地址获取对应像素颜色
- 6.2 ICE 双向连接
- Android开发中网络请求数据后缓存