1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.neo4j.examples.server.unmanaged;
20
21
22
23 import org.neo4j.graphdb.GraphDatabaseService;
24
25 import javax.ws.rs.GET;
26 import javax.ws.rs.Path;
27 import javax.ws.rs.PathParam;
28 import javax.ws.rs.Produces;
29 import javax.ws.rs.core.Context;
30 import javax.ws.rs.core.MediaType;
31 import javax.ws.rs.core.Response;
32
33 import static javax.ws.rs.core.Response.Status;
34
35 @Path( "/helloworld" )
36 public class HelloWorldResource
37 {
38
39 private final GraphDatabaseService database;
40
41 public HelloWorldResource( @Context GraphDatabaseService database )
42 {
43 this.database = database;
44 }
45
46 @GET
47 @Produces( MediaType.TEXT_PLAIN )
48 @Path( "/{nodeId}" )
49 public Response hello( @PathParam( "nodeId" ) long nodeId )
50 {
51
52 return Response.status( Status.OK ).entity(
53 ( "Hello World, nodeId=" + nodeId ).getBytes() ).build();
54 }
55 }
56
57