Showing how to test an unmanaged extension
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
README.adoc
pom.xml

README.adoc

An example of a Neo4j unmanaged extension

This project is intended as a simple template for creating a Neo4j unmanaged extension. The unmanaged extension returns an array containing the name property of all nodes in the database.

I downloaded Neo4j to this directory so the following instructions make that assumption about its location. If you’ve got Neo4j running elsewhere then change the instructions appropriately.

First let’s build a JAR containing our unmanaged extension:

mvn package

Now let’s copy it into the Neo4j plugins folder:

cp target/dummy-unmanaged-extension-0.0.1-SNAPSHOT.jar neo4j-community-2.2.3/plugins/

Next we add the following line to conf/neo4j-server.properties

org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.unmanaged=/unmanaged

Now let’s go to the Neo4j browser at http://localhost:7474 and put some data in:

create (p:Person {name: "Nicole"})
create (p:Person {name: "Mark"})

Now we can make some calls to our unmanaged extension:

curl http://localhost:7474/unmanaged/example/people
{"people":[{"name":"Mark"},{"name":"Nicole"}]}

The extension can also return us a gzipped response if we ask for it:

$ curl -H "Accept-Encoding:gzip,deflate" http://localhost:7474/unmanaged/example/people
�V*H�/�IU���V�K�2�|���ju�|���|����Zw �Z.

I’m not so good at reading gzipped but if we want to see that in clear text we can pipe the output through gunzip:

$ curl -H "Accept-Encoding:gzip,deflate" http://localhost:7474/unmanaged/example/people | gunzip
{"people":[{"name":"Mark"},{"name":"Nicole"}]}

Much better.