java - 通过 Rest 的 Cypher 请求返回 400 Bad Request,为什么?

标签 java rest neo4j jersey

我尝试了一个简单的密码休息请求。但我收到 400 Bad Request 作为响应。请求输出看起来没问题。怎么了?

public class HelloRest {
  public static String SERVER_ROOT_URI = "http://localhost:7474/db/data/";

  public static void main(String[] args) {
    Client client = Client.create();
    client.addFilter(new LoggingFilter(System.out));
    WebResource cypher = client.resource(SERVER_ROOT_URI + "cypher");
    String request = "{\"query\":\"MATCH (n) RETURN n\"}";
    ClientResponse cypherResponse = cypher.post(ClientResponse.class, request);
    System.out.println(cypherResponse);
  }
}

最佳答案

确保对 AcceptContent-Type HTTP header 使用 application/json。如果这没有帮助,请转储完整的请求和完整的回复,并将它们附加到您的问题中。

关于java - 通过 Rest 的 Cypher 请求返回 400 Bad Request,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21886106/

相关文章:

java - OpenShift 上 Wildfly 9 的 wss 失败

java - Spring数据Mongodb检索数据: @Document VO returns null

java - 没有 Spring Cloud 数据流的 Spring Batch

ScrollPane 中的 JavaFX GridPane 比预期大

php - 如何安全地将 apiKey/客户端密码从 AngularJS 传递到 REST API

ios - AFNetworking 500 响应正文

java - 用于过滤资源的 Spring Rest Controller

neo4j - 如何将 List<CustomObject> 持久化为节点的属性?

neo4j - 使用neo4j服务器而不是嵌入模式

c# - 如何在 .Net 中对 Neo4j 进行单元测试?