Database Reference
In-Depth Information
Unmanaged extensions
Unmanaged extensions provide fine-grained control over server-side code. It provides flex-
ibility to deploy an arbitrary piece of JAX-RS code into your Neo4j server and then further
exposes it as a new REST endpoint. We need to be careful while developing and deploying
unmanaged extensions, as it can directly impact the performance of the server, in case of
poorly written code.
Let's extend our Spring-Neo4j project and perform the following steps to implement
unmanaged extensions to get all the node IDs from the Neo4j database:
1. Create a new package
org.neo4j.custom.server.extension.unmanaged and define a new
Java class GetAllNodes.java under this new package.
2. Add the following code in GetAllNodes.java and follow the comments
provided in the code to understand the implementation logic:
package org.neo4j.custom.server.extension.unmanagaed;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import javax.ws.rs.core.Response.*;
import org.neo4j.graphdb.*;
import org.neo4j.shell.util.json.JSONObject;
import org.neo4j.tooling.GlobalGraphOperations;
//Context Path for exposing it as REST endpoint
@Path("/getAllNodes")
public class GetAllNodes {
private final GraphDatabaseService graphDb;
//Injected by the Neo4j Server
public GetAllNodes(@Context GraphDatabaseService
graphDb) {
Search WWH ::




Custom Search