ch04s04 Update java application for thorntail
This commit is contained in:
parent
dec01143fb
commit
ce90e852f6
3 changed files with 28 additions and 13 deletions
|
|
@ -1,13 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.redhat.training.example</groupId>
|
<groupId>com.redhat.training.example</groupId>
|
||||||
<artifactId>java-serverhost</artifactId>
|
<artifactId>java-serverhost</artifactId>
|
||||||
<name>Java Server Host Application</name>
|
<name>Thorntail Example</name>
|
||||||
<version>1.0</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<version.wildfly.swarm>2.1.0.Final</version.wildfly.swarm>
|
<version.thorntail>2.4.0.Final</version.thorntail>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
|
@ -19,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.thorntail</groupId>
|
<groupId>io.thorntail</groupId>
|
||||||
<artifactId>bom-all</artifactId>
|
<artifactId>bom-all</artifactId>
|
||||||
<version>${version.wildfly.swarm}</version>
|
<version>${version.thorntail}</version>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -27,12 +29,12 @@
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>java-serverhost</finalName>
|
<finalName>demo</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.thorntail</groupId>
|
<groupId>io.thorntail</groupId>
|
||||||
<artifactId>thorntail-maven-plugin</artifactId>
|
<artifactId>thorntail-maven-plugin</artifactId>
|
||||||
<version>${version.wildfly.swarm}</version>
|
<version>${version.thorntail}</version>
|
||||||
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
@ -46,14 +48,12 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Java EE 7 dependency -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax</groupId>
|
<groupId>javax</groupId>
|
||||||
<artifactId>javaee-api</artifactId>
|
<artifactId>javaee-api</artifactId>
|
||||||
<version>7.0</version>
|
<version>7.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- WildFly Swarm Fractions -->
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.redhat.training.example.swarmhelloworld.rest;
|
package com.redhat.training.example.javaserverhost.rest;
|
||||||
|
|
||||||
|
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
@ -13,8 +13,14 @@ public class ServerHostEndPoint {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces("text/plain")
|
@Produces("text/plain")
|
||||||
public Response doGet() throws Exception {
|
public Response doGet() {
|
||||||
String host = InetAddress.getLocalHost().getHostName();
|
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();
|
return Response.ok("I am running on server "+host+" Version 1.0 \n").build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue