2

My team is currently in the process of repackaging Neo4j webadmin console to make it usable as a Glassfish standard JavaEE web application. We build that on top of neo4j-jca-connector.

We have already found a way to repackage the various web resources and serve them from our war. we now fight against the various REST endpoints.

Indeed, those endpoints all have their neo4j Database injected as @Context elements (see for example RestfulGraphDatabase constructor). We can access a Neo4J database through JNDI naming and @Resource injection. But, as we don't want to change any line of code of those REST resources, how can we inject the database in that JAX-RS resource ?

Can we do something in web.xml ?

Do we have to write a JAX-RS Application class ?

Riduidel
  • 22,052
  • 14
  • 85
  • 185

2 Answers2

1

In order to add custom @Context parameters, you must create a @Provider class (implementing Injectable) for each type you wish to inject. See this question for details.

Community
  • 1
  • 1
Kricket
  • 4,049
  • 8
  • 33
  • 46
0

I think this is used in http://docs.neo4j.org/chunked/snapshot/server-unmanaged-extensions.html so you can take a look at how the database object is inserted there, https://github.com/neo4j/community/tree/master/server ?

Peter Neubauer
  • 6,311
  • 1
  • 21
  • 24