java - 需要简单的 Neo4j Rest 概念验证方面的帮助

标签 java rest neo4j

我有两个简单的类用于测试 Neo4j 服务器上的休息调用。 我已将 .jar 文件放置在插件目录中,其中包含路径,例如:

gov/lanl/graphing/execute/rest/HelloWorldResource.class

我修改了 neo4j-server.properties 文件,例如:

org.neo4j.server.thirdparty_jaxrs_class=
     gov.lanl.graphing.execute.rest=/gov/lanl/graphing/execute/rest

我认为我对上述属性缺乏了解。

这里有两个类,HelloWorldResrource 类是插件目录中的类。注意:有一些奇怪的语法,所以请忽略奇怪的变量名称等。

这非常简单,我认为问题是我不明白 server.properties 文件中的路径应该如何在 Main 类中表示。谢谢你的帮助。

public class Resting {

    public static String URI = "http://localhost:7474/gov/lanl/graphing/execute/rest/helloworld/";
    public static void main (String[] args) {

        Client client = Client.create();
        client.addFilter(new LoggingFilter(System.out));
        WebResource cypher = client.resource(URI + "rico");
        ClientResponse cypherResponse = cypher.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
        cypherResponse.close();
        System.out.println(cypherResponse);
    }
}


@Path("/helloworld")
public class HelloWorldResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("/{name}")
    public Response hello(@PathParam("name") String name)
    {
        return Response.status(Status.OK).entity(
                ("hello there , " + name).getBytes(Charset.forName("UTF-8"))).build();
    }
}

最佳答案

好吧,经过我的合资企业的多次争论。代码,我发现了几个错误。

首先:
org.neo4j.server.thirdparty_jaxrs_class= 应该: org.neo4j.server.thirdparty_jaxrs_classes=

第二:

我没有正确配置 .jar 文件,我重新配置了此编译以正确包含类路径和降序目录。问题解决了。解决更困难的问题......

关于java - 需要简单的 Neo4j Rest 概念验证方面的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27628721/

相关文章:

java - 所有 json 对象都会在文本更改时更新吗?

java - 如何在 Spring 后端获取可变 HTML 表单值 (POST)

R:在将数据发布到使用管道工创建的 REST API 的同时在网页上打印绘图

neo4j - 在 neo4j 中使用 Unwind 和 Dumping 数据 - 查询优化

neo4j - 如何计算属性之间的差异和百分位数?

Java 文件操作

java - Dropwizard 配置不适用于 Shaded jar

java - 如何将图片内容保存到Neo4J数据库中?关于Java IO

java - 当作为参数传递时,在 Java 中正确表示 ^A (Unicode\u0001)

ios - 无法让 DispatchGroup 在 Swift 中正常工作