Skip to content

Commit

Permalink
adding even Consume annotation for better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
peterneubauer committed Oct 2, 2012
1 parent bd2f520 commit 02c6e6b
Showing 1 changed file with 16 additions and 17 deletions.
Expand Up @@ -18,6 +18,7 @@
*/
package org.neo4j.examples.server.unmanaged;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
Expand All @@ -30,24 +31,22 @@
import org.neo4j.graphdb.GraphDatabaseService;

//START SNIPPET: HelloWorldResource
@Path( "/helloworld" )
public class HelloWorldResource
{
private final GraphDatabaseService database;
@Path("/helloworld")
public class HelloWorldResource {
private final GraphDatabaseService database;

public HelloWorldResource( @Context GraphDatabaseService database )
{
this.database = 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(
( "Hello World, nodeId=" + nodeId ).getBytes() ).build();
}
@GET
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
@Path("/{nodeId}")
public Response hello(@PathParam("nodeId") long nodeId) {
// Do stuff with the database
return Response.status(Status.OK)
.entity(("Hello World, nodeId=" + nodeId).getBytes()).build();
}
}
// END SNIPPET: HelloWorldResource

0 comments on commit 02c6e6b

Please sign in to comment.