Created
August 10, 2016 11:59
-
-
Save vvavepacket/0fc1d1a4151fe7c0909be96bc31cee83 to your computer and use it in GitHub Desktop.
HelloWorldResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.neo4j.examples.server.unmanaged; | |
| import javax.ws.rs.GET; | |
| import javax.ws.rs.Path; | |
| import javax.ws.rs.PathParam; | |
| import javax.ws.rs.Produces; | |
| import javax.ws.rs.core.Context; | |
| import javax.ws.rs.core.MediaType; | |
| import javax.ws.rs.core.Response; | |
| import javax.ws.rs.core.Response.Status; | |
| import org.neo4j.graphdb.GraphDatabaseService; | |
| import org.neo4j.string.UTF8; | |
| @Path( "/helloworld" ) | |
| public class HelloWorldResource { | |
| private final GraphDatabaseService database; | |
| public HelloWorldResource( @Context GraphDatabaseService database ) | |
| { | |
| this.database = database; | |
| } | |
| @GET | |
| @Produces( MediaType.TEXT_PLAIN ) | |
| @Path( "/{nodeId}" ) | |
| public Response hello( @PathParam( "nodeId" ) long nodeId ) | |
| { | |
| // Do stuff with the database | |
| return Response.status( Status.OK ).entity( UTF8.encode( "Hello World, nodeId=" + nodeId ) ).build(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment