简体   繁体   English

连接Neo4j与Glassfish通过休息

[英]Connection Neo4j with Glassfish via Rest

Hello and thanks for your time! 您好,谢谢您的时间! I have been looking for solution long enough, but didn't find how to connect glassfish with built-in Jersey via Rest. 我一直在寻找足够长的解决方案,但没有找到如何通过Rest连接glassfish和内置Jersey。 Actually, it's not a point make it via Rest, but I found out that I can't do that anyway else, if I plan using not-embedded neo4j. 实际上,通过休息不是一点,但我发现如果我计划使用未嵌入的neo4j,我无论如何都不能这样做。

http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html In the manual I need to install Jersey, but that Jersey is different than Glassfish's one, there's no needed classes inside. http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html在手册中我需要安装Jersey,但是Jersey与Glassfish不同,里面没有必要的类。 I cant just replace Jersey files in Glassfish because of GF incompability. 由于GF不兼容,我无法替换Glassfish中的Jersey文件。 So, do I need to use another Jersey client, foreing to Glassfish, for Rest queries? 那么,我是否需要使用另一个Jersey客户端,对Glassfish来说,进行Rest查询?

I found also framework neo4j-rest-graphdb, but I'm not sure it will work and probably is what I need. 我发现了框架neo4j-rest-graphdb,但我不确定它是否会起作用,可能就是我需要的东西。 http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-rest-graphdb/2.0.0-M06/ http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-rest-graphdb/2.0.0-M06/

I found JDBC driver for Neo4j - is this a better for these purposes? 我找到了Neo4j的JDBC驱动程序 - 这对于这些目的更好吗? Thank you! 谢谢!

Neo4j uses jersey version 1.* while glassfish uses version 2.* Neo4j使用泽西版1. *而glassfish使用版本2. *

The API has been changed as you can check in their respective docs : API已更改,因为您可以检查他们各自的文档:

You basically need to create a client in both cases, and then define a webresource in 1.*, and a webtarget in 2.* 您基本上需要在两种情况下都创建一个客户端,然后在1. *中定义一个webresource,在2. *中定义一个webtarget。

The import paths were also modified. 导入路径也被修改。

For instance, the client in 1.* is : 例如,1. *中的客户端是:

import com.sun.jersey.api.client.Client;

while in 2.* it is : 而在2. *它是:

import javax.ws.rs.client.Client;

You should check the API for more details. 您应该查看API以获取更多详细信息。

I assume you are using Glassfish 4. You can use the Jersey client APIs bundled with it you don't need to install one. 我假设您正在使用Glassfish 4.您可以使用与其捆绑的Jersey客户端API,您无需安装它。 Some of the client class names in the Jersey2 client are different then Jersey 1 Jersey2客户端中的某些客户端类名称与Jersey 1不同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM