我试图从Apache Flex前端使用neo4j的REST API。当我的Flex应用程序连接到基本URL(http://localhost:7474/db/data/
)以发现其他服务URL时,它会以HTML格式(而不是JSON格式)回复回复(就像我在浏览器中输入基本URL一样)。neo4j REST API获取HTML响应而不是JSON
在Flex HTTP请求,我给自己定了的Content-Type和接受头既为“application/JSON”,但它没有作出区别。我也试过GET和POST请求方法。
我已验证neo4j能够通过简单的Telnet窗口发送JSON响应,因此它必须根据HTTP请求中的内容“智能”地格式化回复。我想内容类型和接受标题将照顾它,但。
我意识到这个问题在技术上并不在neo4j中,而是在Flex的HTTPService(和支持)类中的某个地方,但我在解决明显的错误/限制方面没有成功。
有没有办法简单地强制所有这样的响应从neo4j只是在JSON格式?
感谢,
克里斯
*编辑*
如下要求,这里是确切的答复我得到我的Flex应用程序:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Root</title><meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href='http://resthtml.neo4j.org/style/rest.css' rel='stylesheet' type='text/css'>
<script type='text/javascript' src='/webadmin/htmlbrowse.js'></script>
</head>
<body onload='javascript:neo4jHtmlBrowse.start();' id='root'>
<div id='content'><div id='header'><h1><a title='Neo4j REST interface' href='/'><span>Neo4j REST interface</span></a></h1></div>
<div id='page-body'>
<table class="root"><caption>Root</caption>
<tr class='odd'><th>relationship_index</th><td><a href="http://localhost:7474/db/data/index/relationship">http://localhost:7474/db/data/index/relationship</a></td></tr>
<tr><th>node_index</th><td><a href="http://localhost:7474/db/data/index/node">http://localhost:7474/db/data/index/node</a></td></tr>
</table>
<div class='break'> </div></div></div></body></html>
这如果我只是手动将基础URL放入我的Web浏览器并以这种方式检索,我会得到同样的结果。
所以也许用“flex”,“http”,“json”来标记这篇文章呢?它适用于javascript和node.js,并且afaik只能查看http-headers,你确定它们到达服务器吗?也许使用ngrep或tcpdump来检查? – 2013-04-09 06:51:33