用于Zope2的JSON-RPC服务器
Products.jsonserver的Python项目详细描述
提供来自zope2的json-rpc请求。
文件
该产品会对发布服务器进行修补,以满足zope2中的json/rpc请求。 它基于:
- original product for earlier versions of Zope2 by Balazs Ree
- jsonserver for zope3 by Jim Washington jwashin@vt.edu and Contributors
- ZPublisher/xmlrpc.py
json是javascript对象表示法。JSON-RPC执行相同的服务 作为xml-rpc,除了格式是javascript脚本对象而不是 xml,内容类型为“application/json rpc”,而不是“text/xml”。
这个项目重写一些基本的zope2代码来提供 正确监听和响应类型请求的功能 “应用程序/json”。
使用Zope 2.10和Zope 2.13对产品进行测试
安装:
把这个鸡蛋加到你的Zope/Plone积木里。
用法:
类似于xmlrpc用法。
jsonserver查找内容类型“application/json”,并处理 请求为json-rpc。其他http请求不受影响,并将 想必工作如期。
对于web浏览器(javascript)以外的通信,simplejson 或者其他json实现具有读写功能 json对象。
json-rpc请求的文本如下:
{'id':jsonid,''method':remotemethod,'params':methodparams}
其中:
o jsonid is a string or number that may identify this specific request
o remotemethod is the method to call on the server
o methodparams is a list(javascript Array) of parameters to the method
json-rpc响应的文本如下:
{'id':jsonid,''result':returnedresult,'error':returnederr}
其中:
o jsonid is the same jsonid as sent in the request
o returnedresult is a javascript representation of the result or null
o returnederr is a javascript representation of an error state
returnedresult或returnederr将是javascript空值。
使用urllib的实际实现作为 读者提示:使用minjson.write(对象)和minjson.read(字符串) 传输前后的转换方法。
五个扩展
“json”命名空间(http://namespaces.zope.org/json)定义 page和pages指令。json:page与 browser:page中的用法,但是 允许在json请求中调用,但将 对于普通请求不可见。
browser:page和browser:page声明将 可用于普通请求和json请求。
json:page可以从代码和 它们的宏将从其他模板中可见。
<json:page name="myjsonrpcview" for="*" class=".jsonrpc.MyJsonRpcView" permission="zope2.ViewManagementScreens" />
代码:
产品代码可在以下位置找到: https://bitbucket.org/tomgross/products.jsonserver
更改历史记录
1.2B6(2013-06-17)
- plone 4.3兼容性 [rristow]
1.2B5(2012-03-21)
- 在manifest.in中包括zcml文件 [汤姆•格罗斯]
1.2B4(2012-03-21)
- 另一个清单.in fix [汤姆•格罗斯]
1.2b3(2012-03-21)
- 添加了manifest.in并修复了破碎的鸡蛋 [汤姆•格罗斯]
1.2b2(2012-03-20)
- 使用simplejson/json而不是minjson实现 [汤姆•格罗斯]
- 仅允许UTF-8作为输入编码 [汤姆•格罗斯]
- Zope 2.13兼容性 [汤姆•格罗斯]
- 修复了与重氮一起使用时出现的问题 [汤姆•格罗斯]
1.2b1(2011-10-07)
- 带字符集的固定内容类型 [汤姆·格罗斯,谢谢史蒂夫·斯皮克米尔]
- 已更改has_keywith uuu contains_uu呼叫 [汤姆•格罗斯]
- 固定发送未授权状态 [汤姆•格罗斯]
- 根据JSON-RPC规范返回错误对象 http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ErrorObject [汤姆·格罗斯,谢谢史蒂夫·斯皮克米尔]
1.2A1(2010-07-15)
- Zope 2.10的修复程序
- 从http://www.zope.org/Members/ree/jsonserver2中的旧产品移动 [汤姆•格罗斯]
贡献者
- Tom Gross,作者
- 平衡树
- 罗德里戈·里斯托