Database Reference
In-Depth Information
Curl client
Java REST binding
Number of
server calls
made
Scenario
Description
Cold
Warm
Cold
Warm
2
Cypher call
1
740 ms
45 ms
104 ms
32 ms
3
Server plugin 1
147 ms
20 ms
76 ms
16 ms
Unmanaged ex-
tension
4
10.5.4. Unmanaged extensions
If you require complete control over your server-side code, then unmanaged extensions
maybewhatyou'relookingfor.Unlikeserverplugins,whichmerelyallowyoutoaugment
the existing REST API at specific points, unmanaged extensions essentially allow you to
define your own domain-specific REST API. Instead of nodes and relationships, you can
now deal in users and movies if you so choose.
Neo4j makes this possible by allowing you to deploy arbitrary JAX-RS (Java API for
RESTful web services) classes to the server. JAX-RS provides a set of APIs that are sup-
posedtomakedevelopingRESTservicesapieceofcakefordevelopers.Broadlyspeaking,
you define a Java class, which, through a set of annotations, binds the class to a particular
URL pattern and mount point within the Neo4j server. When this mount point is invoked,
control is transferred to this class, which can have full access to the Neo4j graph database,
allowing the class to perform whatever actions or functionality is required, returning the
data in whatever format is desired. Though the protocol still needs to be over HTTP, the
data format isn't restricted to only JSON and HTML, as with the REST API and server
plugins.
Warning!
Unmanaged extensions essentially give youunrestricted access touse andinfluence the re-
sources of the Neo4j server. This is extremely powerful, but you need to be careful you
don'taccidentally shootyourselfinthefoot,sotospeak.Thiscouldbedonebyconsuming
all of the JVM heap space while performing an expensive traversal of some sort. Provided
you understand what you're doing, this can be a powerful tool in your toolbox, but as the
saying goes: With great power comes great responsibility!
 
Search WWH ::




Custom Search