WIP(ch9lab) add source for java-based todo-api app

This commit is contained in:
Dan K
2019-07-22 15:38:35 -04:00
parent c37d409c1d
commit 81fbcfc240
20 changed files with 610 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package com.redhat.training.rest;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.ejb.Stateless;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.redhat.training.model.Host;
@Stateless
@Path("host")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class HostService {
@GET
public Host getHostInfo() throws UnknownHostException {
InetAddress address = InetAddress.getLocalHost();
Host host = new Host(address.getHostAddress(), address.getHostName());
return host;
}
}