下载  >  开发技术  >  Web开发  > Comet and Reverse Ajax:The Next-Generation Ajax 2.0

Comet and Reverse Ajax:The Next-Generation Ajax 2.0 评分:

"One of the most basic laws of a web application is that the client, not the server, must initiate any communication between the two. There are a number of common–use cases where, ideally, the server would like to talk to the client—dashboards and monitoring apps, chat rooms and other collaborations
Long pollin Issues with Naive Comet Implementations ●自000@0。0自。000000自0。0自。0@自00自@0。0 47 Request limits in the browser .48 Server-Side performance Concerns 5 NetworkInfrastructure...www.50 Summary. 51 Chapter 4: Comet the easy Way. 53 The Emergence of comet Tools…… 53 Direct Web remoting… 自。。。@。。●鲁。00@0。。。。●。鲁0。。@。@。。。00。。00。0。。。。。 54 DWR in action .55 DWRServlet 58 DWR and comet 62 Magnetic poetry meets dWr on the client Side 62 Magnetic Poetry and dWr on the Server Side.... 64 Routing magnetic poetry events …66 Wrapping up this implementation…… 68 Summa 69 Chapter 5: Scaling comet in Java 71 Thread Management for the web 71 wait/notify Difficulties in Using wait/notify with Comet 76 Jety6.… 77 USing Jetty Continuations………… .77 Understanding the Continuation Mechanisn……………80 Drawbacks of Continuations 82 ii firstPress Comet and Reverse ajax Jetty Continuations and DwR 83 Future Comet Support in Java........…………,84 Summary 。。。●。。。。。。春。。0。。。告0●●。。。。。。。0。。。。●。●。。。0。。。。00。。春。。0。。。告。。 85 Chapter 6: Introducing Bayeux ■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 87 Http reQuest Management n88 Naming Channels… 90 Message format 91 Standard channels ●自。。。。。●。0。●。@。自。。。自。鲁。。0。。。。。。。鲁。0非自。0春。。0●。。 94 Transport Negotiation 95 Client-Side Implementations.......... 98 Server-Side Implementations......... 102 Using Bayeux with Dojo and Jetty….,,…,,…,104 Server-Side Messaging. 。0@@。@@鲁自春。@0位@0鲁。@。。@0。@位自鲁。@自@@。@ Summary Chapter7: Combining Comet with CRUD.………117 Revisiting Magnetic Poetry.……… 119 Client-Side Initialization Code 。120 Server-Side Initialization Code............. 125 Creating Domain Objects. 128 Comet and reverse ajax firstPress Updating Domain Objects. 130 Deleting Domain Objects 0。@00自。0。0自。。0自。0@自00自@0。0自自。。0。000。0自0。0自自00@自000 l31 Using Cometd for Progress Reports 。。自。鲁。。●。。。@。●。0。自。。。自0。鲁。。。 133 Additional Resources 136 Further reading.…… …136 Further Implementations 137 Emerging Standards 137 ummary 138 iv firstPress. Comet and Reverse ajax Comet and Reverse Ajax: The Next-Generation Ajax 2.0 by dave Crane and Phil McCarthy This is a small book about a big subject As a technology, Ajax was small enough to be described in a few sentences, but it catalyzed huge changes in how we use web technologies(and communities, and business models The full ramifications of those changes are still unfolding And in the middle of this change and upheaval, along comes Comet. Comet, simply put, allows you to send information from the server to the browser without the browser having to ask for it first. That's it-simple and itself very catalytic! Comet is still in its early days, but we believe that it's going to have a big impact on the way the web unfolds over the next few years Were lucky enough to have our names on the front of this book, in exchange for which we spent the prescribed number of late nights in our lonely garrets, putting electronic pen to paper. However, a host of talented people behind us have made this possible. Wed like to extend our thanks to Tom Welsh, richard Dal porto, and Heather lang of Apress for keeping us on schedule (and being patient when we werent and for turning our rough drafts into flowing prose Wed also like to thank Joe walker of the dWr project, Greg wilkins of the Jetty Web Server project, and Dylan Schiemann of the dojo toolkit for answering our questions and for being generally supportive of our efforts to write this book- and,of course, for their broader support of the Ajax and comet communities and turning out such interesting Open Source code in the first place Our friends, families, colleagues, and household pets have also been extremely patient and understanding, and we'd like to thank everyone in the crane and McCarthy households, at Historic Futures, and Skillsmatter for their support Comet and reverse ajax firstPress Aispter 1: What Are Comet and Reverse Cha X? The term"Comet "was coined by Alex russell of the dojo project to describe exchanges between a client and a server in which the server, rather than the client initiates the contact Joe Walker of the direct Web Remoting dwr) project refers to a similar mechanism as" Reverse ajax Much like when the term“Aiax” was coined in2005, the name“ Comet has served as a rallying point around a number of previously disconnected technological projects, such as the nonblocking I/O introduced into Java in 2002. message queue technologies and further back Http 1.1's persistent connections and the push technologies of the late 1990s These technologies have in common an interest in initiatin communication between a client and a server from the server's end Conventional web-based applications are all about client-led communication but there has been a repeated need to discuss server-led communication within the web development community and to provide a name for it. To understand the phenomenon of Comet and reverse ajax, we need to consider why there is a need for it and why it is so out of the ordinary as to require a label of its own In this short book, you're going to address two tasks. You're going to learn the techniques being used to deliver Comet and reverse Ajax in today's cutting-edge web toolkits. You're also going to cut your way through the various tangled incarnations of Comet, Reverse Ajax, and push to figure outwhydeveloperspersistintryingtoturnthehttprequest-response sequence on its head. What business need is there that only Comet(a ka Reverse ajax)can deliver? And is Comet always the best way to meet the ese needs Comet and reverse ajax firstPress 1 WHAT IS AJAX? Were assuming that youve heard the term Ajax" before but for those in need of a pithy, twenty-second, concise definition, here goes. In most web applications, the client sends a request to the server only when refreshing the entire page that is, all of the visual real estate that the user is looking at."Ajax refers to the ability to programmatically talk to the server in the background, without triggering a full-screen refresh Ajax may not sound like a big deal, but it's had big implications for the design of web applications, their workflow and usability and even their business models. We are interested in Comet partly because we believe that it will have a similarly catalytic effect on the evolution of web-based technologies THetroublewithhttp TounderstandComet,firstyouneedtounderstandhttp.asweb developerswereallsomewhatfamiliarwithhttp-mostlyasapartof the infrastructure that we take for granted and generally don' t need to pay much attention to. Let's stop to give it our full attention for a moment Http was designed as a protocol for retrieving documents from remote servers as illustrated in Figure 1-1. As such, it has two important characteristics Communication between the client and the server is al ways initiated by the client and never by the server Connections between the client and server are transient and the server does not maintain any long-term state information regarding the client Atleastthiswasthestateofplaywithversion1.0ofthehttp specification. By version 1. 1, more application-like features, such as firstPress Comet and Reverse Ajax conversational state and persistent connections, were being talked about Well get to those shortly Figure 1-1. in a conventional Http request and response the client initiates the communication Receive Send Headers request request Body Request Client Server Response Headers Receive BOr Send response response 3 Comet challenges that first assumption and allows the server to decide when it should contact the client, as illustrated in Figure 1-2. according to thegroundrulesofhttpthenCometisalreadykickingupastorm Figure 1-2, In a Comet or Reverse Ajax exchange communication is initiated by the server. Client Server Response Headers Receive Body Send message message(1 Comet and Reverse ajax firstPress 3 Figure 1-2 illustrates a single comet exchange between server and client Unlike the classic Http exchange depicted in Figure 1-1, the communication is only one-way, and it starts at the server this is analogous to Steps 3 and 4 in Figure 1-1. Typically, the client wont respond to the server as part of this exchange, although within the larger life cycle of the application, the client will probably also talk to the server by initiating conventional Http requests Although Comet doest agree with Http, a number of workarounds can be used to implement Comet. In fact, we shouldn't really be bothered about breakingthegroundrulesofhttpatallIfyoulookatthesecondrule stated previously, you can see that that is challenged by another common piece of infrastructure that we take for granted namely the Http session Http was never designed to preserve conversational state on the server and in fact, the continuity of a session is ensured by the client (by passing a header or cookie to the server every time it makes a request to remind the server who it is) atthetimeofitsintroduction,thehttpsessionwasseenasacleverhack ofthehttpmodelandasacatalystthatopenedupmanynewusecases for the web, spawning the first generation of web applications. The concept of htTp sessions is now well supported by all but the simplest of web servers and by all major web programming tools. Perhaps in time, Comet will become a standard part of the infrastructure that we can take for granted too. As you'll see in Chapters 6 and 7, work is already underway in reengineering web servers to better support Comet. For now, though, know that Reverse ajax will suffice, so lets consider the reasons why you want to make use of this technique 4firstPressComet and Reverse Ajax

...展开详情
2018-07-24 上传 大小:1.14MB
举报 收藏
分享
Comet Reverse Ajax

EXAMPLE CODE FOR "Comet & Reverse Ajax" by Crane & McCarthy, FirstPress 2008 GENERAL SETUP The examples presented here use Groovy on Grails, a Java-based web technology stack. More details at http://grails.org. To get up and running: 0. Install Java on tyour machine if you need to. You'll need the

立即下载
Apress.Comet.and.Reverse.Ajax.2008

Apress.Comet.and.Reverse.Ajax.2008

立即下载
Comet and Reverse Ajax:The Next-Generation Ajax 2.0

"One of the most basic laws of a web application is that the client, not the server, must initiate any communication between the two. There are a number of common–use cases where, ideally, the server would like to talk to the client—dashboards and monitoring apps, chat rooms and other collaborations

立即下载
comet demo

comet 下载既可以运行,在线会话,支持多人,消息推送!非常好用!

立即下载
tomcat实现comet例子 comet tomcat 随机数

tomcat实现comet例子,实现后台产生每隔几秒产生随机数,前台不刷新显示。tomcat实现comet例子,实现后台产生每隔几秒产生随机数,前台不刷新显示。tomcat实现comet例子,实现后台产生每隔几秒产生随机数,前台不刷新显示。tomcat实现comet例子,实现后台产生每隔几秒产生随机数,前台不刷新显示。

立即下载
comet-ajax

comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天comet-ajax聊天

立即下载
java-comet

java-comet

立即下载
test comet servlet

test comet servlet

立即下载
web im comet

自己写的大作业可以comet的自己写的大作业可以comet的自己写的大作业可以comet的

立即下载
comet基本概念

梅兰日兰comet ups 基本概念的描述,使用comet 系列ups 的必备资料

立即下载
comet的demo

一个简单的comet实现的例子程序,就是comet实现长链接,反向ajax实现

立即下载
Comet Web 应用

Comet_的_Web_应用,关于comet的介绍,还算可以啦!

立即下载
comet4jDemo

Comet4J(Comet for Java)是一个纯粹基于AJAX(XMLHTTPRequest)的服务器推送框架,消息以JSON方式传递,具备长轮询、长连接、自动选择三种工作模式。

立即下载
comet-jquery

comet-jquerycomet-jquerycomet-jquerycomet-jquerycomet-jquery

立即下载
comet pushlet 例子

http长连接comet pushlet 例子 导入eclipse 直接能用

立即下载
comet套件(comet4j-tomcat6/7.jar、comet4j.js)

包含comet4j-tomcat6.jar,comet4j-tomcat7.jar,comet4j.js,以及官网demo:comet4j-tomcat6-demo.war

立即下载
ajax+comet

用 A j a x + Co me t 轻松实现实时we b聊天系统,百度文库里弄下来的

立即下载
wxv.comet一个comet的应用和demo

服务器推送技术(server push)的一个实现demo

立即下载
comet4j-tomcat6.jar和comet4j-tomcat7.jar和comet4j.js

comet4j-tomcat6、comet4j-tomcat7 的jar包和comet4j.js资源下载

立即下载
comet4j-tomcat6.jar、comet4j-tomcat7.jar、comet4j.js

压缩包中包含comet4j向客户端主动推送所需要的jar包和js(comet4j-tomcat6.jar、comet4j-tomcat7.jar、comet4j.js)

立即下载