WIP:feat(ch9s6): add initial code for GE

The "mvn fabric8:deploy" command still does not work, mostly because
it seems that the deployed "service" contains selectors for labels
that are not present on the associated Pod.
This commit is contained in:
Dan K
2019-07-16 07:13:48 -04:00
parent 702686c81d
commit 6e57953cdc
3 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package com.redhat.training.openshift.hello;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/")
public class HelloResource {
@GET
@Path("/hello")
@Produces("text/plain")
public String hello() {
String hostname = System.getenv().getOrDefault("HOSTNAME", "unknown");
String message = System.getenv().getOrDefault("APP_MSG", null);
String response = "";
if (message == null)
response = "Hello world from host "+hostname+"\n";
else
response = "Hello world from host ["+hostname+"].";
response += "Message received = "+message+"\n";
return response;
}
}

View File

@@ -0,0 +1,8 @@
package com.redhat.training.openshift.hello;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/api")
public class JaxRsActivator extends Application {
}