A JSON-RPC server for Zope2
Project description
Serve JSON-RPC requests from Zope2
Change history
1.2b1 (2011-10-07)
fixed content-type with charset [tom_gross, thanks Steve Spicklemire]
changed has_key with __contains__ calls [tom_gross]
fixed sending of unauthorized status [tom_gross]
return error object according to the JSON-RPC specification http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ErrorObject [tom_gross, thanks Steve Spicklemire]
1.2a1 (2010-07-15)
fixes for Zope 2.10
moved from old product from http://www.zope.org/Members/ree/jsonserver2 [tom_gross]
Detailed Documentation
Based on:
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 is javascript object notation. JSON-RPC performs the same service as XML-RPC, except the format is javascript script objects instead of XML, and the content-type is ‘application/json-rpc’ instead of ‘text/xml’.
This project overrides some base zope2 code to provide the additional functionality of listening and responding properly to requests of type “application/json”.
This works with Zope 2.10
Installation:
Add this egg to your Zope/Plone buildout.
Usage:
Similar to xmlrpc usage.
jsonserver looks for content-type “application/json”, and handles those requests as JSON-RPC. Other http requests are not affected and will presumably work as expected.
XXX JSON-RPC with jQuery
For communication other than in a web browser (javascript), minjson.py or other json implementations have functions for reading and writing JSON objects.
The text of a JSON-RPC request looks like:
{'id':jsonid,''method':remotemethod,'params':methodparams}
where:
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
The text of a JSON-RPC response looks like:
{'id':jsonid,''result':returnedresult,'error':returnederr}
where:
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
Either returnedresult or returnederr will be the javascript null value.
Actual implementation using e.g., urllib is left as an exercise for the reader. Hint: Use the minjson.write(object) and minjson.read(string) methods for conversion before and after transport.
Five extensions
The “json” namespace (http://namespaces.zope.org/json) defines the page and pages directives. json:page is identical to browser:page in the usage, but the page or method declared is allowed to be called up in a json request, but will be invisible for normal requests.
browser:page and browser:pages declarations will be available to both normal and json requests.
json:page declarations will be callable from code and their macros will be visible from other templates.
TODO:
gzip?
Contributors
Tom Gross, Author
Balazs Ree
Jim Washington
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Products.jsonserver-1.2b1-py2.4.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdf01cf9b59ce0fb26a03c20ac89d8990b425719ab5eba1a9d3eb8cd479cdfcf |
|
MD5 | 0749fa0a1685b05f3f6e9deae9432ed8 |
|
BLAKE2b-256 | 87b9e4f912d3c3aa42e6745294b4741c859a903157fc62d0468d6fcc59d7d3f3 |