tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johno Crawford <johno.crawf...@sulake.com>
Subject Re: svn commit: r1301284 - in /tomcat/tc7.0.x/trunk: ./ webapps/docs/ webapps/examples/WEB-INF/ webapps/examples/WEB-INF/classes/websocket/ webapps/examples/WEB-INF/classes/websocket/chat/ webapps/examples/WEB-INF/classes/websocket/echo/ webapps/examples/W...
Date Fri, 16 Mar 2012 19:17:33 GMT
On 16/03/2012 12:57 AM, markt@apache.org wrote:
> Author: markt
> Date: Thu Mar 15 23:57:00 2012
> New Revision: 1301284

Looks like chat.html missed the changeset?

>
> URL: http://svn.apache.org/viewvc?rev=1301284&view=rev
> Log:
> Implement chat example
> Plus some minor clean-up.
> Patch provided by Johno Crawford
>
> Added:
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/chat/
>        - copied from r1301280, tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/chat/
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/echo/
>        - copied from r1301280, tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/echo/
> Removed:
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/EchoStream.java
> Modified:
>      tomcat/tc7.0.x/trunk/   (props changed)
>      tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java
>      tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml
>      tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html
>      tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html
>      tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html
>
> Propchange: tomcat/tc7.0.x/trunk/
> ------------------------------------------------------------------------------
> --- svn:mergeinfo (original)
> +++ svn:mergeinfo Thu Mar 15 23:57:00 2012
> @@ -1 +1 @@
> -/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112
>   ,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300111-1300460,1300520-1300948
> +/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112
>   ,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300111-1300460,1300520-1300948,1301280
>
> Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Mar 15 23:57:00 2012
> @@ -100,6 +100,14 @@
>           work with IBM as well as Oracle JVMs. Patch provided by Rohit Kelapure.
>           (markt)
>         </add>
> +<add>
> +        Add support for the WebSocket protocol (RFC6455). Both streaming and
> +        message based APIs are provided and the implementation currently fully
> +        passes the Autobahn test suite. Also included are several examples.
> +        A significant contribution to this new functionality was provided by
> +        Johno Crawford - particularly the examples. Contributions were also
> +        provided by Petr Praus, Jonathan Drake&  Slávka. (markt)
> +</add>
>       </changelog>
>     </subsection>
>     <subsection name="Coyote">
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
(original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
Thu Mar 15 23:57:00 2012
> @@ -93,8 +93,14 @@ public class Snake {
>               head = nextLocation;
>           }
>
> +        handleCollisions(snakes);
> +    }
> +
> +    private void handleCollisions(Collection<Snake>  snakes) {
>           for (Snake snake : snakes) {
> -            if (snake.getTail().contains(head)) {
> +            boolean headCollision = id != snake.id&&  snake.getHead().equals(head);
> +            boolean tailCollision = snake.getTail().contains(head);
> +            if (headCollision || tailCollision) {
>                   kill();
>                   if (id != snake.id) {
>                       snake.reward();
> @@ -103,6 +109,10 @@ public class Snake {
>           }
>       }
>
> +    public synchronized Location getHead() {
> +        return head;
> +    }
> +
>       public synchronized Collection<Location>  getTail() {
>           return tail;
>       }
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java
(original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/SnakeWebSocketServlet.java
Thu Mar 15 23:57:00 2012
> @@ -98,8 +98,8 @@ public class SnakeWebSocketServlet exten
>       private void broadcast(String message) {
>           for (SnakeMessageInbound connection : getConnections()) {
>               try {
> -                CharBuffer response = CharBuffer.wrap(message);
> -                connection.getWsOutbound().writeTextMessage(response);
> +                CharBuffer buffer = CharBuffer.wrap(message);
> +                connection.getWsOutbound().writeTextMessage(buffer);
>               } catch (IOException ignore) {
>                   // Ignore
>               }
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml (original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/web.xml Thu Mar 15 23:57:00 2012
> @@ -350,7 +350,7 @@
>       <!-- WebSocket Examples -->
>       <servlet>
>         <servlet-name>wsEchoStream</servlet-name>
> -<servlet-class>websocket.EchoStream</servlet-class>
> +<servlet-class>websocket.echo.EchoStream</servlet-class>
>       </servlet>
>       <servlet-mapping>
>         <servlet-name>wsEchoStream</servlet-name>
> @@ -358,7 +358,7 @@
>       </servlet-mapping>
>       <servlet>
>         <servlet-name>wsEchoMessage</servlet-name>
> -<servlet-class>websocket.EchoMessage</servlet-class>
> +<servlet-class>websocket.echo.EchoMessage</servlet-class>
>         <!-- Uncomment the following block to increase the default maximum
>              WebSocket buffer size from 2MB to 20MB which is required for the
>              Autobahn test suite to pass fully. -->
> @@ -378,6 +378,14 @@
>         <url-pattern>/websocket/echoMessage</url-pattern>
>       </servlet-mapping>
>       <servlet>
> +<servlet-name>wsChat</servlet-name>
> +<servlet-class>websocket.chat.ChatWebSocketServlet</servlet-class>
> +</servlet>
> +<servlet-mapping>
> +<servlet-name>wsChat</servlet-name>
> +<url-pattern>/websocket/chat</url-pattern>
> +</servlet-mapping>
> +<servlet>
>         <servlet-name>wsSnake</servlet-name>
>         <servlet-class>websocket.snake.SnakeWebSocketServlet</servlet-class>
>       </servlet>
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html (original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/websocket/echo.html Thu Mar 15 23:57:00 2012
> @@ -30,7 +30,7 @@
>
>           #console-container {
>               float: left;
> -            padding-left: 20px;
> +            margin-left: 15px;
>               width: 400px;
>           }
>
> @@ -121,8 +121,8 @@
>       </script>
>   </head>
>   <body>
> -<noscript><h1>Seems your browser doesn't support Javascript! Websockets
rely on Javascript being enabled. Please enable
> -    Javascript and reload this page!</h1></noscript>
> +<noscript><h2 style="color: #ff0000">Seems your browser doesn't support
Javascript! Websockets rely on Javascript being enabled. Please enable
> +    Javascript and reload this page!</h2></noscript>
>   <div>
>       <div id="connect-container">
>           <div>
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html (original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/websocket/index.html Thu Mar 15 23:57:00 2012
> @@ -15,15 +15,17 @@
>     limitations under the License.
>   -->
>   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> -<HTML><HEAD><TITLE>Apache Tomcat WebSocket Examples</TITLE>
> -<META http-equiv=Content-Type content="text/html">
> -</HEAD>
> -<BODY>
> -<P>
> -<H3>Apache Tomcat WebSocket Examples</H3>
> -<P></P>
> +<html>
> +<head>
> +<meta http-equiv=Content-Type content="text/html">
> +<title>Apache Tomcat WebSocket Examples</title>
> +</head>
> +<body>
> +<h3>Apache Tomcat WebSocket Examples</h3>
>   <ul>
> -<li><a href="echo.html">Echo example</a></li>
> -<li><a href="snake.html">Multiplayer snake example</a></li>
> +<li><a href="echo.html">Echo example</a></li>
> +<li><a href="chat.html">Chat example</a></li>
> +<li><a href="snake.html">Multiplayer snake example</a></li>
>   </ul>
> -</BODY></HTML>
> \ No newline at end of file
> +</body>
> +</html>
> \ No newline at end of file
>
> Modified: tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html
> URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html?rev=1301284&r1=1301283&r2=1301284&view=diff
> ==============================================================================
> --- tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html (original)
> +++ tomcat/tc7.0.x/trunk/webapps/examples/websocket/snake.html Thu Mar 15 23:57:00 2012
> @@ -51,8 +51,8 @@
>       </style>
>   </head>
>   <body>
> -<noscript><h1>Seems your browser doesn't support Javascript! Websockets
rely on Javascript being enabled. Please enable
> -    Javascript and reload this page!</h1></noscript>
> +<noscript><h2 style="color: #ff0000">Seems your browser doesn't support
Javascript! Websockets rely on Javascript being enabled. Please enable
> +    Javascript and reload this page!</h2></noscript>
>       <div style="float: left">
>           <canvas id="playground" width="640" height="480"></canvas>
>       </div>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message