falkolab.ext3.direct je server-side zásobník pro ExtJS 3.
Jak mohu použít?
Pojďme zaregistrovat API a výhled:
& Nbsp; & gt; & gt; & gt; od zope.configuration import xmlconfig
& Nbsp; & gt; & gt; & gt; kontext = xmlconfig.string ("" "
& Nbsp; ... & lt; konfigurovat
& Nbsp; ... xmlns = "http://namespaces.zope.org/zope"
& Nbsp; ... xmlns: extdirect = "http://namespaces.zope.org/extdirect"
& Nbsp; ... & gt;
& Nbsp; ... & lt; zahrnují balení = "falkolab.ext3.direct" file = "meta.zcml" / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: api
& Nbsp; ... na = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... namespace = "my.app"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: Pohled
& Nbsp; ... na = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.AlbumList"
& Nbsp; ... permission = "zope.ManageContent"
& Nbsp; ... name = "albumlist"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: Pohled
& Nbsp; ... na = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.Contact"
& Nbsp; ... permission = "zope.ManageContent"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... "" ")
Přímý API:
& Nbsp; & gt; & gt; & gt; print http (R "" "
& Nbsp; ... GET /@@directapi HTTP / 1.1
& Nbsp; ... Authorization: Základní bWdyOm1ncnB3
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 Ok
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Vyprší: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ("my.app");
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "jmenný prostor": "my.app", "typ": "vzdálené komunikace", "akce": {"Kontakt ": [{" name ":" GetInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" přidat "," len ": 0}, {" název ":" getAll "," len ": 0}]}};
Auto přidat poskytovatele:
& Nbsp; & gt; & gt; & gt; print http (R "" "
& Nbsp;? ... GET /@@directapi add_provider HTTP / 1.1
& Nbsp; ... Authorization: Základní bWdyOm1ncnB3
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 Ok
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Vyprší: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ("my.app");
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "jmenný prostor": "my.app", "typ": "vzdálené komunikace", "akce": {"Kontakt ": [{" name ":" GetInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" přidat "," len ": 0}, {" název ":" getAll "," len ": 0}]}};
& Nbsp; Ext.Direct.addProvider (my.app.REMOTING_API);
A Direct Žádost hanling (pro přidávání viz ROUTER.TXT):
& Nbsp; & gt; & gt; & gt; print http (R "" "
& Nbsp; ... POST /@@directrouter HTTP / 1.1
& Nbsp; ... Authorization: Základní bWdyOm1ncnB3
& Nbsp; ... Content-Length: 71
& Nbsp; ... Content-Type: application / json; charset = UTF-8
& Nbsp; ... Referer: http: // localhost /
& Nbsp; ...
& Nbsp; ... {"akce": "albumlist", "metoda": "getAll", "data": [], "type": "RPC", "TID": 1} "" ")
& Nbsp; HTTP / 1.1 200 Ok
& Nbsp; Content-Length: 89
& Nbsp; Content-Type: text / javascript
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; {"akce": "albumlist", "TID": 1, "type": "RPC", "metoda": "getAll", "výsledek": [1, 2, 3]}
Co je nového v této verzi:
- Změny na podporu Python 2.6
Požadavky na :
- Python
Komentáře nebyl nalezen