Skip to content

Commit

Permalink
Merge pull request RedHatTraining#1 from imcsk8/update-java-serverhost
Browse files Browse the repository at this point in the history
Update java serverhost
  • Loading branch information
richardallred authored Jun 19, 2019
2 parents 169ee80 + 95e8656 commit 899e2df
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
29 changes: 9 additions & 20 deletions java-serverhost/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -19,22 +19,22 @@
<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>
</dependencies>
</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>
Expand All @@ -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>
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.redhat.training.example.swarmhelloworld.rest;
package com.redhat.training.example.javaserverhost.rest;


import javax.ws.rs.Path;
Expand All @@ -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();
}
}

0 comments on commit 899e2df

Please sign in to comment.