diff --git a/ping.sh b/ping.sh new file mode 100755 index 0000000..e53e84b --- /dev/null +++ b/ping.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +curl http://localhost:7474/histograph/ping diff --git a/src/main/java/org/waag/histograph/plugins/ExpandConcepts.java b/src/main/java/org/waag/histograph/plugins/ExpandConcepts.java index a034b7c..045a856 100644 --- a/src/main/java/org/waag/histograph/plugins/ExpandConcepts.java +++ b/src/main/java/org/waag/histograph/plugins/ExpandConcepts.java @@ -18,11 +18,12 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.StreamingOutput; import java.io.*; +import java.nio.charset.Charset; import java.util.ArrayList; import javax.ws.rs.core.Context; -@javax.ws.rs.Path( "/expand" ) +@javax.ws.rs.Path( "/" ) public class ExpandConcepts { private GraphDatabaseService graphDb; @@ -50,9 +51,21 @@ public ExpandConcepts(@Context GraphDatabaseService graphDb) { this.objectMapper = new ObjectMapper(); } + @GET + @javax.ws.rs.Path("/ping") + public Response ping(@Context HttpServletRequest request, final InputStream requestBody) { + StreamingOutput stream = new StreamingOutput() { + @Override + public void write(OutputStream os) throws IOException, WebApplicationException { + os.write("pong".getBytes(Charset.forName("UTF-8"))); + } + }; + return Response.ok().entity(stream).type(MediaType.TEXT_PLAIN).build(); + } + @POST - @javax.ws.rs.Path("/") - public Response chips(@Context HttpServletRequest request, final InputStream requestBody) { + @javax.ws.rs.Path("/expand") + public Response expand(@Context HttpServletRequest request, final InputStream requestBody) { StreamingOutput stream = new StreamingOutput() { @Override