Skip to content

Commit

Permalink
ping! 🎾 pong! 🎾 closes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
bertspaan committed Aug 13, 2015
1 parent e40f2a9 commit 02950f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ping.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

curl http://localhost:7474/histograph/ping
19 changes: 16 additions & 3 deletions src/main/java/org/waag/histograph/plugins/ExpandConcepts.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 02950f2

Please sign in to comment.