Debian Codegraph @

activemq-web-demo/src/main/webapp/chat.html

raw symbols SCIP
1 <!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 -->
17
18 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
19 <html>
20 <head>
21 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
22 <title>Chat Example - ActiveMQ Web Demos</title>
23 <link rel="stylesheet" href="chat.css" type="text/css">
24 <style type="text/css" media="screen">
25 @import url(styles/sorttable.css);
26 @import url(styles/type-settings.css);
27 @import url(styles/site.css);
28 @import url(styles/prettify.css);
29 </style>
30
31 <!--<script type="text/javascript" src="js/prototype.js"></script>-->
32 <!--<script type="text/javascript" src="js/amq_prototype_adapter.js"></script>-->
33 <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
34 <script type="text/javascript" src="js/amq_jquery_adapter.js"></script>
35
36 <script type="text/javascript" src="js/amq.js"></script>
37 <script type="text/javascript" src="js/chat.js"></script>
38 <script type="text/javascript">
39
40 // Note, normally you wouldn't just add an onload function in this
41 // manner. In fact, you typically want to fire this method on the
42 // document.onready event, however this type of functionality is verbose
43 // and best left to the domain of your favorite js library.
44 //
45 // For example, in jQuery the following onload would be replaced with:
46 // jQuery(function() {
47 // org.activemq.Amq.init({ uri: 'amq' });
48 // org.activemq.Chat.init();
49 // }
50 window.onload = function() {
51 org.activemq.Amq.init({ uri: 'amq', logging: true, timeout: 45, clientId:(new Date()).getTime().toString() });
52 org.activemq.Chat.init();
53 };
54 </script>
55
56 </head>
57
58 <body>
59
60
61 <div class="white_box">
62 <div class="header">
63 <div class="header_l">
64 <div class="header_r">
65 </div>
66 </div>
67 </div>
68 <div class="content">
69 <div class="content_l">
70 <div class="content_r">
71
72 <div>
73
74 <!-- Banner -->
75 <div id="asf_logo">
76 <div id="activemq_logo">
77 <a style="float:left; width:280px;display:block;text-indent:-5000px;text-decoration:none;line-height:60px; margin-top:10px; margin-left:100px;"
78 href="http://activemq.apache.org/"
79 title="The most popular and powerful open source Message Broker">ActiveMQ</a>
80 <a style="float:right; width:210px;display:block;text-indent:-5000px;text-decoration:none;line-height:60px; margin-top:15px; margin-right:10px;"
81 href="http://www.apache.org/" title="The Apache Software Foundation">ASF</a>
82 </div>
83 </div>
84
85
86 <div class="top_red_bar">
87 <div id="site-breadcrumbs">
88 <a href="index.html" title="Home">Home</a>
89 </div>
90 <div id="site-quicklinks"><P>
91 <a href="http://activemq.apache.org/support.html"
92 title="Get help and support using Apache ActiveMQ">Support</a></p>
93 </div>
94 </div>
95
96 <table border="0">
97 <tbody>
98 <tr>
99 <td valign="top" width="100%" style="overflow:hidden;">
100 <div class="body-content">
101
102 <h1>Chat Example</h1>
103
104 <p>Welcome to the Ajax chat example</p>
105
106 <div id="chatroom">
107 <div id="chat"></div>
108
109 <div id="members"></div>
110
111 <div id="input">
112 <div id="join" class="hidden">
113 Username:&nbsp;
114 <input id="username" type="text"/>
115 <button id="joinB">Join</button>
116 </div>
117 <div id="joined" class="hidden">
118 Chat:&nbsp;
119 <input id="phrase" type="text" />
120 <button id="sendB">Send</button>
121 <button id="leaveB">Leave</button>
122 </div>
123 </div>
124 </div>
125
126 <p>
127 This Chat example creates an ActiveMQ broker using the configuration
128 information found in the <code>web.xml</code> file. There isn't much there.
129 Just a name-value parameter named <code>org.apache.activemq.brokerURL</code>
130 is assigned a value of <code>vm://localhost?broker.persistent=false</code>.
131 This is enough however to lazy-initialize the broker when it is needed.
132 </p>
133 <p>
134 The client leverages a javascript library <code>amq.js</code> to perform all
135 of the JMS-related client side code. This involves establishing a
136 communication pipeline to the JMS server. This pipeline uses a long-poll
137 connection to the server. All JMS communication will be received down this
138 pipe, and when the JMS server has no traffic to send, this pipeline will
139 patiently wait until there is new traffic or until it times out. If a
140 timeout does occur, the connection will reconnect to the server for another
141 round. (Of course you will want/need to use a server that supports
142 continuations in order for this to scale beyond a few hundred clients.)
143 </p>
144 <p>
145 The <code>chat.js</code> file contains the script to respond to the UI
146 interactions. It also talks to the <code>amq.js</code> file to send messages
147 and provides a message handler that will respond to incoming JMS messages.
148 </p>
149 <p>
150 There is no server-side state in this application. The client sets up a JMS
151 Topic on the server and attaches itself as a listener to this topic. From
152 that point, all messages that are sent to the topic are received by each
153 listener. Even the list of members in the chat room are the result of
154 clients replying to a ping request.
155 </p>
156 <p>
157 Please note that <code>amq.js</code> has been refactored to allow AJAX calls
158 to be made using any javascript library. Example adapter classes for <a href="http://jquery.com/">jQuery</a>
159 and <a href="http://www.prototypejs.org/">Prototype</a> have been provided.
160 </p>
161
162
163 </div>
164 </td>
165 <td valign="top">
166
167 <div class="navigation">
168 <div class="navigation_top">
169 <div class="navigation_bottom">
170 <H3>Useful Links</H3>
171
172 <ul class="alternate" type="square">
173 <li><a href="http://activemq.apache.org/"
174 title="The most popular and powerful open source Message Broker">Documentation</a></li>
175 <li><a href="http://activemq.apache.org/faq.html">FAQ</a></li>
176 <li><a href="http://activemq.apache.org/download.html">Downloads</a>
177 </li>
178 <li><a href="http://activemq.apache.org/discussion-forums.html">Forums</a>
179 </li>
180 </ul>
181 </div>
182 </div>
183 </div>
184 </td>
185 </tr>
186 </tbody>
187 </table>
188
189
190 <div class="bottom_red_bar"></div>
191 </div>
192 </div>
193 </div>
194 </div>
195 <div class="black_box">
196 <div class="footer">
197 <div class="footer_l">
198 <div class="footer_r">
199 <div>
200 Copyright 2005-2023 The Apache Software Foundation.
201
202 (<a href="?printable=true">printable version</a>)
203 </div>
204 </div>
205 </div>
206 </div>
207 </div>
208 </div>
209 <div class="design_attribution"><a href="http://hiramchirino.com/">Graphic Design By Hiram</a></div>
210
211 </body>
212 </html>