fix(ch4s4): refactor java source for SG read ease

This commit is contained in:
Dan K 2019-07-19 16:25:45 -04:00
parent a4c63d7a84
commit 2c450b33f4

View file

@ -1,26 +1,26 @@
package com.redhat.training.example.javaserverhost.rest; package com.redhat.training.example.javaserverhost.rest;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import java.net.InetAddress; import java.net.InetAddress;
@Path("/") @Path("/")
public class ServerHostEndPoint { public class ServerHostEndPoint {
@GET @GET
@Produces("text/plain") @Produces("text/plain")
public Response doGet() { public Response doGet() {
String host = ""; String host = "";
try { try {
host = InetAddress.getLocalHost().getHostName(); host = InetAddress.getLocalHost().getHostName();
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return Response.ok("I am running on server "+host+" Version 1.0 \n").build(); String msg = "I am running on server "+host+" Version 1.0 \n"
} return Response.ok(msg).build();
}
} }