From 899e2df31d18220a1f443e3a1a08338a22ca5d43 Mon Sep 17 00:00:00 2001 From: Richard Allred <richardmallred@gmail.com> Date: Wed, 19 Jun 2019 20:08:57 +0200 Subject: [PATCH] Merge pull request #1 from imcsk8/update-java-serverhost --- /dev/null | 20 ---------- java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java | 26 +++++++++++++ java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/RestApplication.java | 9 ++++ java-serverhost/pom.xml | 29 ++++---------- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/java-serverhost/pom.xml b/java-serverhost/pom.xml index 39e3a1c..4babfa1 100644 --- a/java-serverhost/pom.xml +++ b/java-serverhost/pom.xml @@ -4,12 +4,12 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.redhat.training.example</groupId> <artifactId>java-serverhost</artifactId> - <name>Java Server Host Application</name> - <version>1.0</version> + <name>Thorntail Example</name> + <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <properties> - <version.wildfly.swarm>2017.10.0</version.wildfly.swarm> + <version.thorntail>2.4.0.Final</version.thorntail> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> @@ -19,9 +19,9 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.wildfly.swarm</groupId> + <groupId>io.thorntail</groupId> <artifactId>bom-all</artifactId> - <version>${version.wildfly.swarm}</version> + <version>${version.thorntail}</version> <scope>import</scope> <type>pom</type> </dependency> @@ -29,12 +29,12 @@ </dependencyManagement> <build> - <finalName>java-serverhost</finalName> + <finalName>demo</finalName> <plugins> <plugin> - <groupId>org.wildfly.swarm</groupId> - <artifactId>wildfly-swarm-plugin</artifactId> - <version>${version.wildfly.swarm}</version> + <groupId>io.thorntail</groupId> + <artifactId>thorntail-maven-plugin</artifactId> + <version>${version.thorntail}</version> <executions> <execution> @@ -47,15 +47,4 @@ </plugins> </build> - <dependencies> - <!-- Java EE 7 dependency --> - <dependency> - <groupId>javax</groupId> - <artifactId>javaee-api</artifactId> - <version>7.0</version> - <scope>provided</scope> - </dependency> - <!-- WildFly Swarm Fractions --> - - </dependencies> </project> diff --git a/java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java b/java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java deleted file mode 100644 index e09ee8b..0000000 --- a/java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.redhat.training.example.swarmhelloworld.rest; - - -import javax.ws.rs.Path; -import javax.ws.rs.core.Response; -import javax.ws.rs.GET; -import javax.ws.rs.Produces; -import java.net.InetAddress; - - -@Path("/") -public class ServerHostEndPoint { - - @GET - @Produces("text/plain") - public Response doGet() throws Exception { - String host = InetAddress.getLocalHost().getHostName(); - return Response.ok("I am running on server "+host+" Version 1.0 \n").build(); - } -} diff --git a/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/RestApplication.java b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/RestApplication.java new file mode 100644 index 0000000..416d4a6 --- /dev/null +++ b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/RestApplication.java @@ -0,0 +1,9 @@ +package com.redhat.training.example.javaserverhost.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/") +public class RestApplication extends Application { + +} diff --git a/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java new file mode 100644 index 0000000..a5ff9c1 --- /dev/null +++ b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java @@ -0,0 +1,26 @@ +package com.redhat.training.example.javaserverhost.rest; + + +import javax.ws.rs.Path; +import javax.ws.rs.core.Response; +import javax.ws.rs.GET; +import javax.ws.rs.Produces; +import java.net.InetAddress; + + +@Path("/") +public class ServerHostEndPoint { + + @GET + @Produces("text/plain") + public Response doGet() { + String host = ""; + try { + host = InetAddress.getLocalHost().getHostName(); + } + catch (Exception e) { + e.printStackTrace(); + } + return Response.ok("I am running on server "+host+" Version 1.0 \n").build(); + } +} -- Gitblit v1.9.3