没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
1.介绍(Introduction) ...................................................................................................................... 3
2.动机(Motivation) ........................................................................................................................ 4
3.通知解决(Notification Solutions) ............................................................................................... 5
3.1 轮询(Polling) ....................................................................................................................... 6
3.2 服务器端回调(Server-side callbacks)................................................................................. 6
3.3 消息(Messaging MOM) ..................................................................................................... 6
3.4 讨论(Discussion) ................................................................................................................. 7
4.pushlet 基础(Pushlet Basics) ...................................................................................................... 8
4.1HTTP 流(HTTP Streaming) .................................................................................................... 9
4.2 示例 1(Example1) ............................................................................................................... 9
4.3 示例 2(Example2) ............................................................................................................. 10
5.不仅 Java-动态超文本标记语言 (Not just Java - Dynamic HTML) ......................................... 14
6.框架设计(Design of the Framework) ....................................................................................... 16
6.1. 服务器端类设计 Server-side class design ..................................................................... 18
6.1.1.场景:事件订阅 (Scenario: Event Subscription) ................................................. 20
6.1.2.场景:发送和派分事件 Scenario: Sending and Dispatching Events.................... 22
6.2.客户端框架 Client-side framework ................................................................................. 24
7.应用(Applications) .................................................................................................................... 27
7.1. 监控 Monitoring ............................................................................................................. 28
7.2. 游戏 Gaming ................................................................................................................... 28
7.3.分布式模型-视图-控制器 Distributed Model View Controller (MVC) ........................... 28
7.4. Web 表现层 Web Presentations...................................................................................... 29
7.5. 用户辅助 User Assistance .............................................................................................. 30
7.6.社区工具 Community Tools ............................................................................................ 31
8.倾向(Liabilities) ......................................................................................................................... 31
8.1. 优点 Advantages ............................................................................................................. 31
8.2.缺点 Disadvantages ......................................................................................................... 32
9.更进一步的工作(Further Work) .............................................................................................. 33
9.1. 额外的客户端接收协议:例如 TCP 和 UDP(Additional client receiver-protocols such as
TCP and UDP) ....................................................................................................................... 33
9.2. 额外的服务器端发送协议 additional client sender-protocols ..................................... 34
9.3. 主题状态 subject state ................................................................................................... 34
9.4. 多用户 multi-user ........................................................................................................... 35
10.参考(References) .................................................................................................................... 35
1.介绍(Introduction)
Server-side notification to browser-clients is often implemented using
applets with RMI, CORBA or custom TCP/IP messaging. These techniques are
often complex to implement, have firewall restrictions, and require additional
server development/maintenance. Also it is hard to integrate the state of the
client-applet with the browser's page-content other than refreshing the page
or doing all content-layout within the applet.
Server 端向浏览器 client 发送通知这种通讯模式通常采用 RMI、CORBA
或者自定义 TCP/IP 信息来实现。这些技术往往由于复杂而难以实现:存在
防火墙限制(因为需要打开非 HTTP 的通讯端口)、需要额外的 server 开发
和维护。并且除了刷新整个页面或者完全采用 applet 展示内容之外,很难
找到别的方法将 client 端 applet 的状态和浏览器的页面内容集成在一起。
Pushlets are a servlet-based mechanism where data is pushed directly
from server-side Java objects to (Dynamic) HTML pages within a
client-browser without using Java applets or plug-ins. This allows a web page
to be periodically updated by the server. The browser client uses
JavaScript/Dynamic HTML features available in type 4+ browsers like NS and
MSIE. The underlying mechanism uses a servlet HTTP connection over which
JavaScript code is pushed to the browser. Through a single generic servlet (the
Pushlet), browser clients can subscribe to subjects from which they like to
receive events. Whenever the server pushes an event, the clients subscribed
to the related subject are notified. Event objects can be sent as either
JavaScript (DHTML clients), serialized Java objects (Java clients), or as XML
(DHTML or Java Clients). Several application examples are presented such as
monitoring (weather, live stock feed, system status) and a multi-user
applications (chat).
Pushlet(一种 comet 架构的实现)是基于 Servlet 机制,数据从 server
端的 Java 对象直接推送(push)到客户端浏览器的(动态)HTML 页面,而
无需任何 Java applet 或者插件的帮助。它使 server 端可以周期性地更新
client 的 web 页面,这与传统的 request/response 方式相悖。浏览器 client
为兼容 JavaScript1.4 版本以上的浏览器(如 Internet Explorer、FireFox),
并使用 JavaScript/Dynamic HTML特性。而 低 层 实 现 使 用一个 servlet通过 Http
连接到 JavaScript 所在的浏览器,并将数据推送到后者。使用 Phushlet,客
户端浏览器能订阅它们希望接受事件的主题,无论何时,server 推出一个事
件,订阅相关主题的客户端将得到通知。事件对象既可以作为 JavaScript
(DHTML clients)、序列化的 Java 对象(Java clients)也可以作为 XML (DHTML or
Java Clients)而发送。几个这方面的应用的例子:例如监测(天气情况、股
票实时情报、系统状态报告)和多用户应用(聊天)。
The mechanism is lightweight in the sense that uses the servlet server's
connection management and threading facilities, the javax.servlet APIs and
standard Java features such as producer/consumer through Object wait() and
notify(). In principle the framework could run within any servlet-supporting
server and behind firewalls. When JavaScript/DHTML is used on the client this
provides a convenient way to build applications quickly through scripting and
to integrate and layout new content with HTML/CSS features.
这种机制是轻量级的,它使用 server 端的 servlet 连接管理、线程工具、
javax.servlet API,并通过标准 Java 特性中 Object 的 wait()和 notify()实现的
生产者/消费者机制。原则上,Pushlet 框架能够穿过防火墙运行在任何支持
servlet 的 server 上。当在 client 中使用 JavaScript/DHTML 时,Pushlet 提供
了通过脚本快速建立应用、使用 HTML/CSS 特性集成和布局新内容的便利方
法。
2.动机(Motivation)
Now that more and more Servlets and JavaServer Pages (JSPs) are being
deployed on the web, there is often a need to notify and synchronize client
web-browsers from state changes in server objects after the browser has
loaded a page.
目前越来越多的 servlet 和 JSP 用来部署 web,于是便出现了在页面已
经装载完毕后由于 server端某些对象的状态变化而产生对 client浏览器进行
通知和同步的需要。
These changes can be caused by users updating an EJB through a servlet
or database record or by events in a multi-user application such as chat and
shared whiteboard. These type of applications often use a distributed Model
View Controller (MVC) pattern where the Model is on the server (with possible
caching in clients) and the Control and View (possibly combined) reside within
the client.
这些状态变化的原因很复杂:可能由于用户通过访问 servlet 或者修改
数据库记录、更新 EJB 造成,或是在多用户应用(比如聊天室和共享白板)
中的事件导致数据状态变化。这些类型的应用常常使用一种分布式的 MVC
模式:模型层位于 server 上(可能缓存在 client 中),控制层和视图层位于
client 中(这两个层可能合为一体)。
There are also applications where we would like to subcribe to dynamic
content that is continuously pushed from the server. Examples stock feeds,
system status, weather conditions or other monitoring applications. This
follows an Observer (a.k.a. Publish/Subscribe) pattern where remote clients
(Observers) register for updates from server objects (Subjects).
当然,这里也存在需要订阅 server 端动态内容的应用:那些动态内容
不停地从 server 端推送过来。例如股票实时情报、系统状态报告、天气情
况或者其它的监测应用。它遵循观察者(Observer)模式(也称为发布/订
阅模板),这种模板中的远程 client 注册成为关注于 server 端对象变化的观
察者。关于设计模板的知识请看 Matrix Wiki 上的介绍。
How can we notify browser-clients after their HTML page has loaded ? Or
what to do if we would like to selectively update only parts of a page. For
example only the stock item in an HTML TABLE whose rate has changed ?
那么在 HTML 页面已经被装载后如何通知浏览器客户端?或者如果有
选择地更新页面中一些部分的话,那该怎么做?比如只更新在 HTML Table
中的那些价格发生变化的股票列?
3.通知解决(Notification Solutions)
剩余34页未读,继续阅读
资源评论
- ysc_java2012-09-26研究了下 源码 很是 迷茫啊 用不太来 但是 整体的原理 熟悉了80%
- yingyingchenhtb2013-08-31很好的学习资料正在学习中
- voidin2014-11-24不错.不过还没去研究源码,
- shishuai199102172015-02-03挺好的资源对我的帮助很大
- 绝版男子2014-01-08简单介绍了下,还是学习下吧。
voice1122
- 粉丝: 13
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 05-培训总结表.xlsx
- 培训评估调查问卷.xlsx
- 培训实践效果反馈与评估表(行动学习反馈).xlsx
- 培训评估反馈表.docx
- 培训评估管理办法(修改).docx
- 柯氏四级培训评估体系.doc.docx
- 基于java的旅游管理系统设计与实现
- 【年度培训】培训效果评估办法行政人事CLUB.docx
- 【年度培训】年度培训计划方案行政人事CLUB.docx
- 【年度培训】年度培训计划 (1)行政人事CLUB.docx
- 【年度培训】集团年度培训计划与方案汇编行政人事CLUB.docx
- 【年度培训】行政办公系统培训资料行政人事CLUB.docx
- 【年度培训】企业培训效果评估表行政人事CLUB.doc
- 【年度培训】培训效果评估报告分析行政人事CLUB.doc
- 打印機設定:M337x-387x-407x-Series-WIN-SPL-PCL-V3.13.13.00.01-CDV1.38
- 【年度培训】培训需求分析行政人事CLUB.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功