adding java app
This commit is contained in:
parent
030f3351a1
commit
0f618dcf35
3 changed files with 142 additions and 0 deletions
61
.gitignore
vendored
Normal file
61
.gitignore
vendored
Normal file
|
|
@ -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
|
||||
61
java-serverhost/pom.xml
Normal file
61
java-serverhost/pom.xml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?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>
|
||||
<groupId>com.redhat.training.example</groupId>
|
||||
<artifactId>java-serverhost</artifactId>
|
||||
<name>Java Server Host Application</name>
|
||||
<version>1.0</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
<version.wildfly.swarm>2017.10.0</version.wildfly.swarm>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wildfly.swarm</groupId>
|
||||
<artifactId>bom-all</artifactId>
|
||||
<version>${version.wildfly.swarm}</version>
|
||||
<scope>import</scope>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>java-serverhost</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.wildfly.swarm</groupId>
|
||||
<artifactId>wildfly-swarm-plugin</artifactId>
|
||||
<version>${version.wildfly.swarm}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>package</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</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>
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue