【问题标题】:TinkerPop3 rest test via browserTinkerPop3 通过浏览器进行休息测试
【发布时间】:2015-09-14 08:35:21
【问题描述】:

我在发出 curl 请求时得到了有效的响应:

bin/gremlin-server.bat conf/gremlin-server-rest-modern.yaml

curl "http://localhost:8182?gremlin=100-1"
curl "http://localhost:8182?gremlin=g.V()"

但是通过浏览器我得到以下按摩:

{"message":"no gremlin script supplied"}

也尝试如下但没有结果:

http://localhost:8182/gremlin?script=g.V()
http://localhost:8182/graphs/tinkergraph/tp/gremlin?script=g.traversal().V()
http://localhost:8182/graphs/tinkergraph/tp/gremlin?script=g.V()

关于什么是通过浏览器传递脚本的有效方式的任何建议。

【问题讨论】:

    标签: gremlin tinkerpop3


    【解决方案1】:

    我的问题是由于请求中存在空格。

    这行得通;

    curl http://localhost:8182/?gremlin="g.V().has('name','foody')"
    

    但这没有;

    curl http://localhost:8182/?gremlin="g.V().has('name', 'foody')"
    

    尝试将它们从您的设备中删除,它们应该可以工作。

    【讨论】:

      【解决方案2】:

      感谢您的提问,我找到了答案,因此我将为@stacey-morgan 寻找正确答案: 您在 CLI 上查询:

      curl "http://localhost:8182?gremlin=100-1"
      

      那么你可能已经查询过了(因为你的问题并不清楚)

      http://localhost:8182/gremlin?script=100-1
      

      或者你做过的其他人,就像我做的那样:

      http://localhost:8182/gremlin?script=g.V()
      

      您会收到错误消息。 正确的做法是从 curl 命令中粘贴“”的内容。所以

      http://localhost:8182?gremlin=100-1
      

      然后对于您的其他查询类似:

      http://localhost:8182/?gremlin=g.V()
      http://localhost:8182/?gremlin=g.traversal().V()
      

      注意:斜杠 should 在那里,尽管它在我的 FF 上没有它也可以工作。那就是 HTTP。

      使用:Ubuntu & Titan1.0.0-hadoop1。

      【讨论】:

        【解决方案3】:

        当我忘记在启动 gremlin-server 之前启动 cassandra 时,我也看到了这个错误。

        【讨论】:

        • 谢谢你,正是我的问题。
        【解决方案4】:

        我不确定这到底是不是一个“错误”,但 Gremlin Server 不尊重非常复杂的 ACCEPT 标头。例如,当我尝试在 Chrome 中解析您的前两个 URL 之一时,我得到:

        {
          message: "no serializer for requested Accept header: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
        }
        

        默认情况下,Gremlin Server 不支持 ACCEPT。如果浏览器请求了application/json 或只是*.*,它将起作用。请注意,*.* 以质量 0.8 存在,但 Gremlin Server 并未以这种方式解析标头来确定这一点。结果,它找不到序列化程序来正确处理它。

        我所知道的浏览器没有解决方法。我创建了一个问题来解决这个问题:

        https://issues.apache.org/jira/browse/TINKERPOP3-752

        【讨论】:

          猜你喜欢
          • 2015-02-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-11-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多