Dan K
2019-07-19 2c450b33f4c68e5800eb2eac01f5442fe294b5c5
commit | author | age
ce90e8 1 package com.redhat.training.example.javaserverhost.rest;
IC 2
3 import javax.ws.rs.Path;
4 import javax.ws.rs.core.Response;
5 import javax.ws.rs.GET;
6 import javax.ws.rs.Produces;
7 import java.net.InetAddress;
8
9 @Path("/")
10 public class ServerHostEndPoint {
11
2c450b 12   @GET
DK 13   @Produces("text/plain")
14   public Response doGet() {
15     String host = "";
16     try {
17       host = InetAddress.getLocalHost().getHostName();
18     }
19     catch (Exception e) {
20        e.printStackTrace();
21     }
22     String msg = "I am running on server "+host+" Version 1.0 \n"
23     return Response.ok(msg).build();
24   }
ce90e8 25 }
2c450b 26