From 0f618dcf358143b9de0f427e070dcb6ed4e4e478 Mon Sep 17 00:00:00 2001 From: Richard Allred Date: Mon, 17 Jun 2019 08:44:20 -0400 Subject: [PATCH] adding java app --- .gitignore | 61 +++++++++++++++++++ java-serverhost/pom.xml | 61 +++++++++++++++++++ .../training/example/ServerHostEndPoint.java | 20 ++++++ 3 files changed, 142 insertions(+) create mode 100644 .gitignore create mode 100644 java-serverhost/pom.xml create mode 100644 java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f1890e --- /dev/null +++ b/.gitignore @@ -0,0 +1,61 @@ +########################## +## Java +########################## +*.class +.mtj.tmp/ +*.jar +*.war +*.ear +hs_err_pid* + +########################## +## Maven +########################## +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties + +########################## +## IntelliJ +########################## +*.iml +.idea/ +*.ipr +*.iws +out/ +.idea_modules/ + +########################## +## Eclipse +########################## +.metadata +.classpath +.project +.settings/ +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.loadpath + +########################## +## NetBeans +########################## +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml + +########################## +## OS X +########################## +.DS_Store \ No newline at end of file diff --git a/java-serverhost/pom.xml b/java-serverhost/pom.xml new file mode 100644 index 0000000..39e3a1c --- /dev/null +++ b/java-serverhost/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + com.redhat.training.example + java-serverhost + Java Server Host Application + 1.0 + war + + + 2017.10.0 + 1.8 + 1.8 + false + UTF-8 + + + + + + org.wildfly.swarm + bom-all + ${version.wildfly.swarm} + import + pom + + + + + + java-serverhost + + + org.wildfly.swarm + wildfly-swarm-plugin + ${version.wildfly.swarm} + + + + + package + + + + + + + + + + + javax + javaee-api + 7.0 + provided + + + + + 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 new file mode 100644 index 0000000..e09ee8b --- /dev/null +++ b/java-serverhost/src/main/java/com/redhat/training/example/ServerHostEndPoint.java @@ -0,0 +1,20 @@ +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(); + } +}