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 @@ 4.0.0 com.redhat.training.example java-serverhost - Java Server Host Application - 1.0 + Thorntail Example + 1.0.0-SNAPSHOT war - 2017.10.0 + 2.4.0.Final 1.8 1.8 false @@ -19,9 +19,9 @@ - org.wildfly.swarm + io.thorntail bom-all - ${version.wildfly.swarm} + ${version.thorntail} import pom @@ -29,12 +29,12 @@ - java-serverhost + demo - org.wildfly.swarm - wildfly-swarm-plugin - ${version.wildfly.swarm} + io.thorntail + thorntail-maven-plugin + ${version.thorntail} @@ -47,15 +47,4 @@ - - - - javax - javaee-api - 7.0 - provided - - - - 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/ServerHostEndPoint.java b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java similarity index 56% rename from java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java rename to java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java index e09ee8b..a5ff9c1 100644 --- a/java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java +++ b/java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest/ServerHostEndPoint.java @@ -1,4 +1,4 @@ -package com.redhat.training.example.swarmhelloworld.rest; +package com.redhat.training.example.javaserverhost.rest; import javax.ws.rs.Path; @@ -13,8 +13,14 @@ public class ServerHostEndPoint { @GET @Produces("text/plain") - public Response doGet() throws Exception { - String host = InetAddress.getLocalHost().getHostName(); + 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(); } }