From: Gustavo Martin Morcuende Date: Tue, 29 Mar 2016 02:20:06 +0000 (+0200) Subject: Spring and STOMP, first steps X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=79ab5b76f94f6dae273e35246e22aeaf0abf25f6;p=JavaForFun Spring and STOMP, first steps --- diff --git a/SpringJava/STOMP/spring-stomp-server/pom.xml b/SpringJava/STOMP/spring-stomp-server/pom.xml new file mode 100644 index 0000000..08f1537 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/pom.xml @@ -0,0 +1,117 @@ + + 4.0.0 + + de.spring.stomp + spring-stomp + 1.0-SNAPSHOT + + + spring-stomp-server + war + spring-stomp-server + http://gumartinm.name + STOMP with Spring Framework. + + Gustavo Martin Morcuende + http://www.gumartinm.name + + + scm:git:http://git.gumartinm.name/JavaForFun + http://git.gumartinm.name/JavaForFun + + + + + + org.springframework + spring-context + + + org.springframework + spring-webmvc + + + org.springframework + spring-oxm + + + + + org.springframework + spring-websocket + + + + + org.springframework + spring-messaging + + + + + javax.servlet + javax.servlet-api + provided + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + + javax.validation + validation-api + + + org.hibernate + hibernate-validator + + + + + ${project.artifactId} + + + ${basedir}/src/main/webapp + + **/*.* + + + + ${basedir}/src/main/resources/ + + **/*.* + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + + + true + src/main/webapp + + WEB-INF/web.xml + + + + + + + + diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java new file mode 100644 index 0000000..6500435 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/stomp/handlers/MyCustomHandler.java @@ -0,0 +1,13 @@ +package de.spring.stomp.handlers; + +import org.springframework.web.socket.TextMessage; +import org.springframework.web.socket.WebSocketSession; +import org.springframework.web.socket.handler.TextWebSocketHandler; + +public class MyCustomHandler extends TextWebSocketHandler { + + @Override + public void handleTextMessage(WebSocketSession session, TextMessage message) { + + } +} diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java new file mode 100644 index 0000000..930aaf8 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/java/de/spring/webservices/rest/controller/GreetingController.java @@ -0,0 +1,17 @@ +package de.spring.webservices.rest.controller; + +import java.time.LocalDateTime; + +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.stereotype.Controller; + + +@Controller +public class GreetingController { + + @MessageMapping("/greeting") + public String handle(String greeting) { + return "[" + LocalDateTime.now() + ": " + greeting; + } + +} diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml new file mode 100644 index 0000000..281da4f --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/log4j2.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml new file mode 100644 index 0000000..54b8540 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/mvc/rest/rest-config.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml new file mode 100644 index 0000000..892d490 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/resources/spring-configuration/spring-configuration.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml b/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..00d1c2e --- /dev/null +++ b/SpringJava/STOMP/spring-stomp-server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + Spring STOMP: example + + + + org.springframework.web.context.ContextLoaderListener + + + + + spring.profiles.active + ${environment.profile} + contextConfigLocation + + classpath*:spring-configuration/*.xml + + + + + + spring-rest + org.springframework.web.servlet.DispatcherServlet + 1 + true + + contextConfigLocation + classpath*:spring-configuration/mvc/rest/*.xml + + + + + spring-rest + + /* + + + diff --git a/SpringJava/STOMP/spring-stomp/pom.xml b/SpringJava/STOMP/spring-stomp/pom.xml new file mode 100644 index 0000000..8630bf6 --- /dev/null +++ b/SpringJava/STOMP/spring-stomp/pom.xml @@ -0,0 +1,316 @@ + + 4.0.0 + de.spring.stomp + spring-stomp + pom + 1.0-SNAPSHOT + spring-stomp + http://gumartinm.name + Emails with Spring Framework + + Gustavo Martin Morcuende + http://www.gumartinm.name + + + scm:git:http://git.gumartinm.name/JavaForFun + http://git.gumartinm.name/JavaForFun + + + + UTF-8 + UTF-8 + 4.2.5.RELEASE + + + + + release + + release + + + true + + + + + + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.3 + + + + org.apache.logging.log4j + log4j-core + 2.3 + + + + org.slf4j + jcl-over-slf4j + 1.7.12 + + + + + cglib + cglib + 2.2.2 + + + + + junit + junit + 4.12 + test + + + org.mockito + mockito-core + 2.0.43-beta + test + + + + + + org.springframework + spring-context + ${spring.version} + + + + commons-logging + commons-logging + + + + + + + org.springframework + spring-websocket + ${spring.version} + + + + commons-logging + commons-logging + + + + + + + org.springframework + spring-messaging + ${spring.version} + + + + commons-logging + commons-logging + + + + + + + org.springframework + spring-webmvc + ${spring.version} + + + + commons-logging + commons-logging + + + + + org.springframework + spring-oxm + ${spring.version} + + + + commons-logging + commons-logging + + + + + + + + javax.servlet + javax.servlet-api + 4.0.0-b01 + provided + + + + + com.fasterxml.jackson.core + jackson-databind + 2.6.4 + + + + + javax.validation + validation-api + 1.1.0.Final + + + org.hibernate + hibernate-validator + 5.2.2.Final + + + + + + org.springframework + spring-test + ${spring.version} + test + + + + commons-logging + commons-logging + + + + + com.icegreen + greenmail + 1.5.0 + test + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.19.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-resources-plugin + 2.7 + + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + ${project.description} + ${project.version} + ${project.organization.name} + ${project.description} + ${project.version} + ${project.organization.name} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + **/*IntegrationTest.java + + + + + +