Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
de:jvx:common:util:rest [2019/03/13 09:11] admin |
de:jvx:common:util:rest [2020/07/24 23:42] admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~Title: REST Dienste~~ | ~~Title: REST Dienste~~ | ||
- | Wir definieren die Business Logik mit [[de:jvx:server:lco:objects|Life-Cycle Objekten]] am Server. Die Zugriffsberechtigung einer Applikation wird durch einen [[de:jvx:server:security:manager|Security Manager]]geprüft. Der Zugriff auf die Business Logik erfolgt üblicherweise via Master- oder SubConnections vom Client. | + | Wir definieren die Business Logik mit [[de:jvx:server:lco:objects|Life-Cycle Objekten]] am Server. Die Zugriffsberechtigung einer Applikation wird durch einen [[de:jvx:server:security:manager|Security Manager]] geprüft. Der Zugriff auf die Business Logik erfolgt üblicherweise via Master- oder SubConnections vom Client. |
Um die Technologie Unabhängigkeit zu vollenden, steht die Komplette Business Logik einer Applikation auch via REST zur Verfügung. | Um die Technologie Unabhängigkeit zu vollenden, steht die Komplette Business Logik einer Applikation auch via REST zur Verfügung. | ||
Line 44: | Line 44: | ||
Anmeldung testen:\\ | Anmeldung testen:\\ | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>testAuthentication</fc>**'' \\ | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>testAuthentication</fc>**'' \\ |
oder \\ | oder \\ | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>testAuthentication</fc>**/**<fc #BF0000>parameter</fc>**'' | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>testAuthentication</fc>**/**<fc #BF0000>parameter</fc>**'' |
Der Request benötigt eine HashMap im JSON Format. | Der Request benötigt eine HashMap im JSON Format. | ||
Line 67: | Line 67: | ||
Anmeldung testen:\\ | Anmeldung testen:\\ | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>changePassword</fc>**'' \\ | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>changePassword</fc>**'' \\ |
oder \\ | oder \\ | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>changePassword</fc>**/**<fc #BF0000>parameter</fc>**'' | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>changePassword</fc>**/**<fc #BF0000>parameter</fc>**'' |
Der Request benötigt eine HashMap im JSON Format. | Der Request benötigt eine HashMap im JSON Format. | ||
Line 101: | Line 101: | ||
Der Aufruf erfolgt mittels: | Der Aufruf erfolgt mittels: | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>ACTION</fc>**'' \\ | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>ACTION</fc>**'' \\ |
oder \\ | oder \\ | ||
- | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/**<fc #BF0000>LIFECYCLE_CLASS</fc>**/_admin/**<fc #BF0000>ACTION</fc>**/**<fc #BF0000>parameter</fc>**'' | + | ''<nowiki>http://server:port/webapp/services/rest/</nowiki>**<fc #BF0000>APPLICATION_NAME</fc>**/_admin/**<fc #BF0000>ACTION</fc>**/**<fc #BF0000>parameter</fc>**'' |
==== Storage Zugriff (CRUD, Meta Data) ==== | ==== Storage Zugriff (CRUD, Meta Data) ==== | ||
Line 465: | Line 465: | ||
curl_close($ch); | curl_close($ch); | ||
+ | </file> | ||
+ | |||
+ | Mittels Javascript: | ||
+ | |||
+ | <file html rest.html> | ||
+ | <html> | ||
+ | <head> | ||
+ | <script> | ||
+ | function doRest() { | ||
+ | const http = new XMLHttpRequest(); | ||
+ | const url='https://<server>/DB/services/rest/League/Standings/action/getResults'; | ||
+ | |||
+ | http.open("POST", url, true, 'user', 'password'); | ||
+ | http.withCredentials = true; | ||
+ | http.send("[88]"); | ||
+ | |||
+ | http.onreadystatechange=(e)=> | ||
+ | { | ||
+ | if (http.readyState == 4) | ||
+ | { | ||
+ | console.log(atob(eval(http.responseText))); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </script> | ||
+ | </head> | ||
+ | <body> | ||
+ | <button type="button" onclick="doRest()">REST call</button> | ||
+ | </body> | ||
+ | </html> | ||
</file> | </file> | ||