falkolab.ext3.direct stosu jest po stronie serwera dla ExtJS 3.
Jak go używać?
Miejmy zarejestruj API i widoki:
& Nbsp; & gt; & gt; & gt; z zope.configuration importu xmlconfig
& Nbsp; & gt; & gt; & gt; context = xmlconfig.string ("" "
& Nbsp; ... & lt; skonfigurować
& Nbsp; ... xmlns = "http://namespaces.zope.org/zope"
& Nbsp; ... xmlns: extdirect = "http://namespaces.zope.org/extdirect"
& Nbsp; ... & gt;
& Nbsp; ... & lt; to pakiet = "falkolab.ext3.direct" file = "meta.zcml" / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: api
& Nbsp; ... o = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... namespace = "my.app"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: view
& Nbsp; ... o = "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: view
& Nbsp; ... o = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.Contact"
& Nbsp; ... Permission = "zope.ManageContent"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... "" ")
Bezpośredni API:
& Nbsp; & gt; & gt; & gt; drukuj http (r "" "
& Nbsp; ... GET / HTTP@@directapi / 1.1
& Nbsp; ... Autoryzacja: Podstawowe 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; Wygasa: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ("my.app ');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "przestrzeń nazw": "my.app", "typ": "usług zdalnych", "działania": {"Kontakt ": [{" name ":" GetInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" dodatek "," len ": 0}, {" name ":" getAll "," len ": 0}]}};
Auto dodać dostawcy:
& Nbsp; & gt; & gt; & gt; drukuj http (r "" "
& Nbsp;? ... GET / HTTP@@directapi add_provider / 1.1
& Nbsp; ... Autoryzacja: Podstawowe 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; Wygasa: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace ("my.app ');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "przestrzeń nazw": "my.app", "typ": "usług zdalnych", "działania": {"Kontakt ": [{" name ":" GetInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," name ":" dodatek "," len ": 0}, {" name ":" getAll "," len ": 0}]}};
& Nbsp; Ext.Direct.addProvider (my.app.REMOTING_API);
I bezpośrednie Zapytanie Hanling (dodawania zobaczyć ROUTER.TXT):
& Nbsp; & gt; & gt; & gt; drukuj http (r "" "
& Nbsp; ... POST /@@directrouter HTTP / 1.1
& Nbsp; ... Autoryzacja: Podstawowe bWdyOm1ncnB3
& Nbsp; ... Content-Length: 71
& Nbsp; ... Content-Type: application / json; charset = UTF-8
& Nbsp; ... Referer: http: // localhost /
& Nbsp; ...
& Nbsp; ... {"działanie": "albumlist", "metoda": "getAll", "dane": [], "typ": "rpc", "trzy razy dziennie": 1} "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Content-Length: 89
& Nbsp; Content-Type: text / javascript
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; {"działanie": "albumlist", "trzy razy dziennie": 1, "typ": "rpc", "metoda": "getAll", "Wynik": [1, 2, 3]}
Co nowego w tym wydaniu:
- Zmiany wspierać Python 2.6
Wymagania :
- Python
Komentarze nie znaleziono