diff --git a/undertow/chat/pom.xml b/undertow/chat/pom.xml new file mode 100644 index 0000000..3f07b5c --- /dev/null +++ b/undertow/chat/pom.xml @@ -0,0 +1,126 @@ + + + 4.0.0 + + org.wildfly.undertow + undertow-websocket-chat + 1.0 + war + WildFly Undertow WebSocket Chat + + http://wildfly.org + + + Apache License, Version 2.0 + repo + http://www.apache.org/licenses/LICENSE-2.0.html + + + + + + + UTF-8 + + + 1.0.0.Final + + + 3.1 + 2.1.1 + + + 1.7 + 1.7 + + + 8.0.0.Final + 1.0.0.Final + + + + + + + org.jboss.spec + jboss-javaee-all-7.0 + ${version.jboss.spec.javaee.7.0} + pom + import + + + + + + + + org.jboss.spec.javax.websocket + jboss-websocket-api_1.0_spec + provided + + + + + + ${artifactId} + + + maven-war-plugin + ${version.war.plugin} + + + false + + + + + org.wildfly.plugins + wildfly-maven-plugin + ${version.wildfly.maven.plugin} + + + + maven-compiler-plugin + ${version.compiler.plugin} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + + + + openshift + + + + maven-war-plugin + ${version.war.plugin} + + deployments + ROOT + + false + + + + + + + + diff --git a/undertow/chat/src/main/java/org/wildfly/undertow/chat/ChatServerEndpoint.java b/undertow/chat/src/main/java/org/wildfly/undertow/chat/ChatServerEndpoint.java new file mode 100644 index 0000000..bf6c075 --- /dev/null +++ b/undertow/chat/src/main/java/org/wildfly/undertow/chat/ChatServerEndpoint.java @@ -0,0 +1,18 @@ +package org.wildfly.undertow.chat; + +import javax.websocket.OnMessage; +import javax.websocket.Session; +import javax.websocket.server.ServerEndpoint; + + +@ServerEndpoint("/chat") +public class ChatServerEndpoint { + + @OnMessage + public void chat(String text, Session client) { + + System.out.println(text); + + client.getAsyncRemote().sendText(text.toUpperCase()); + } +} diff --git a/undertow/chat/src/main/webapp/index.html b/undertow/chat/src/main/webapp/index.html new file mode 100644 index 0000000..e8a27ca --- /dev/null +++ b/undertow/chat/src/main/webapp/index.html @@ -0,0 +1,85 @@ + +Undertow Chat + + + + +
+
+
+ + +
+ +
+ + +
+
+
+ + diff --git a/undertow/pom.xml b/undertow/pom.xml index 69c3e32..aab368a 100644 --- a/undertow/pom.xml +++ b/undertow/pom.xml @@ -18,6 +18,7 @@ quickstart + chat