forked from thinkaurelius/titan-web-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitanWebService.java
48 lines (40 loc) · 1.18 KB
/
TitanWebService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.thinkaurelius.titan.webexample;
import org.codehaus.jettison.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
/**
* This class handles the HTTP requests.
*/
@Path("/")
@Component
public class TitanWebService {
@Autowired
GroovyGraphOp groovyOp;
@Autowired
JavaGraphOp javaOp;
@PostConstruct
private void init() {
System.out.println("Initialized Titan Web Example Service");
}
@GET
@Path("/listVertices")
@Produces(MediaType.TEXT_PLAIN)
public String listVertices(@Context UriInfo info) throws JSONException {
String res = javaOp.listVertices();
return "\"" + res + "\"";
}
@GET
@Path("/plutosBrothers")
@Produces(MediaType.TEXT_PLAIN)
public String pipeline(@Context UriInfo info) throws JSONException {
String res = groovyOp.getPlutosBrothers();
return "\"" + res + "\"";
}
}