64 | | === CHTMLBrowserHost === |
65 | | This component hosts the web browser control and exposes whatever interfaces/callbacks the control |
66 | | requires for logging and display purposes. As part of its creation process it creates/exposes |
67 | | the !JavaScript interface for CHTMLBrowserWnd to use. |
68 | | |
69 | | === CHTMLBrowserHostUI === |
70 | | This component acts as the !JavaScript interoperability component. It should only support single |
71 | | threaded access. |
| 56 | === HTTP Server === |
| 57 | This component serves up content from the slot directory running the application. It should only be |
| 58 | bound to the loopback adapter and should not provide a default document nor a directory listing |
| 59 | when queried. It should only serve up files that are contained within the slot directory structure. |
| 60 | |
| 61 | === HTTP Server RPCs === |
| 62 | |
| 63 | ==== Embedded Static Content ==== |
| 64 | The following files are embedded within the executable: |
| 65 | || Namespace || Contents || |
| 66 | || /api/static/index.html || [http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=blob;f=samples/gfx_html/templates/index.html;hb=master index.html] || |
| 67 | || /api/static/boinc.png || [http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=blob;f=samples/gfx_html/templates/boinc.png;hb=master boinc.png] || |
| 68 | || /api/static/boinc.js || [http://boinc.berkeley.edu/gitweb/?p=boinc-v2.git;a=blob;f=samples/gfx_html/templates/boinc.js;hb=master boinc.js] || |
| 69 | |
| 70 | ==== Retrieve init_data.xml ==== |
| 71 | Returns the contents of the init_data.xml file. |
| 72 | |
| 73 | || Namespace: || /api/getInitData || |
| 74 | || Parameters: || None || |
| 75 | || Returns: || XmlDocument || |
| 76 | |
| 77 | ==== Retrieve graphics_status.xml ==== |
| 78 | Returns the contents of the graphics_status.xml file and in addition the Vboxwrapper WebAPI and Remote |
| 79 | Desktop port information. |
| 80 | |
| 81 | || Namespace: || /api/getGraphicsStatus || |
| 82 | || Parameters: || None || |
| 83 | || Returns: || XmlDocument || |
| 84 | |
| 85 | ==== Reset reread_init_data_file flag ==== |
| 86 | Resets the internal flag notifying the HTML application it needs to read the init_data.xml file. This |
| 87 | flag is published as part of the /api/getGraphicsStatus API. |
| 88 | |
| 89 | || Namespace: || /api/resetReadFlag || |
| 90 | || Parameters: || None || |
| 91 | || Returns: || XmlDocument || |
| 92 | |
| 93 | ==== Calling RPCs ==== |
| 94 | Here is some prototype code for calling the described RPCs: |
| 95 | {{{ |
| 96 | function createRequest { |
| 97 | var xmlHttp = null; |
| 98 | var XMLHttpFactories = [ |
| 99 | function () { return new XMLHttpRequest() }, |
| 100 | function () { return new ActiveXObject('Msxml2.XMLHTTP') }, |
| 101 | function () { return new ActiveXObject('Msxml3.XMLHTTP') }, |
| 102 | function () { return new ActiveXObject('Microsoft.XMLHTTP') } |
| 103 | ]; |
| 104 | |
| 105 | for (var i = 0; i < XMLHttpFactories.length; i++) { |
| 106 | try { |
| 107 | xmlHttp = XMLHttpFactories[i](); |
| 108 | } catch (e) { |
| 109 | continue; |
| 110 | } |
| 111 | break; |
| 112 | } |
| 113 | return xmlHttp; |
| 114 | } |
| 115 | |
| 116 | function sendRequest(url) { |
| 117 | var req = createRequest(); |
| 118 | var response = null; |
| 119 | req.open('GET', url, false); |
| 120 | req.send(); |
| 121 | response = req.responseXML; |
| 122 | req = null; |
| 123 | return response; |
| 124 | } |
| 125 | |
| 126 | var xmlDocument = sendRequest('/api/getInitData'); |
| 127 | |
| 128 | }}} |