falkolab.ext3.direct est une pile côté serveur pour ExtJS 3.
Comment puis-je utiliser?
Enregistrons api et vues:
& Nbsp; & gt; & gt; & gt; de zope.configuration importation XMLConfig
& Nbsp; & gt; & gt; & gt; context = xmlconfig.string ("" "
& Nbsp; ... & lt; configurer
& Nbsp; ... xmlns = "http://namespaces.zope.org/zope"
& Nbsp; ... xmlns: extdirect = "http://namespaces.zope.org/extdirect"
& Nbsp; ... & gt;
& Nbsp; ... & lt; inclure package = "falkolab.ext3.direct" file = "meta.zcml" / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: api
& Nbsp; ... pour = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... namespace = "my.app"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: vue
& Nbsp; ... pour = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.AlbumList"
& Nbsp; ... la permission = "zope.ManageContent"
& Nbsp; ... name = "albumlist"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: vue
& Nbsp; ... pour = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.Contact"
& Nbsp; ... la permission = "zope.ManageContent"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... "" ")
API Direct:
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp; ... GET /@@directapi HTTP / 1.1
& Nbsp; ... Autorisation: bWdyOm1ncnB3 base
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Expire: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ('my.app');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "espace de noms": "my.app", "type": "accès distant", "actions": {"Contact ": [{" name ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" ajouter "," len ": 0}, {" nom ":" getAll "," len ": 0}]}};
Auto ajouter fournisseur:
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp;? ... GET /@@directapi add_provider HTTP / 1.1
& Nbsp; ... Autorisation: bWdyOm1ncnB3 base
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Expire: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ('my.app');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "espace de noms": "my.app", "type": "accès distant", "actions": {"Contact ": [{" name ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" ajouter "," len ": 0}, {" nom ":" getAll "," len ": 0}]}};
& Nbsp; Ext.Direct.addProvider (my.app.REMOTING_API);
Et Demande directe Hanling (pour plus voir ROUTER.TXT):
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp; ... POST /@@directrouter HTTP / 1.1
& Nbsp; ... Autorisation: bWdyOm1ncnB3 base
& Nbsp; ... Content-Length: 71
& Nbsp; ... Content-Type: application / json; charset = UTF-8
& Nbsp; ... Referer: http: // localhost /
& Nbsp; ...
& Nbsp; ... {"action":, "méthode" "albumlist": "getAll", "data": ", tapez" []: "RPC", "tid": 1} "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Content-Length: 89
& Nbsp; Content-Type: text / javascript
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; {"action": "albumlist", "tid": 1, "type": "RPC", "méthode": "getAll", "résultat": [1, 2, 3]}
Ce qui est nouveau dans cette version:
- Changements pour soutenir Python 2.6
Exigences :
- Python
Commentaires non trouvées