You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/HttpServer/HttpServer.md
+53-22Lines changed: 53 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ One also can provide extra arguments for THttpServer itself:
41
41
- readonly, ro - use server in read-only mode (default)
42
42
- readwrite, rw - use server in read-write mode
43
43
- global - let scan global directories for canvases and files (default)
44
-
- noglobal - disable scan of global directories
44
+
- noglobal - disable scan of global directories
45
45
46
46
Example:
47
47
@@ -99,6 +99,33 @@ string to the icon name to let browser show command as extra button. In last cas
99
99
One can find example of command interface usage in [tutorials/http/httpcontrol.C](https://github.com/root-project/root/blob/master/tutorials/http/httpcontrol.C) macro.
100
100
101
101
102
+
## Customize user interface
103
+
104
+
JSROOT is used to implement UI for the THttpServer. Defualt webpage shows list of registered objects on the left side and drawing area on the right side - [see example](https://root.cern/js/latest/httpserver.C/). JSROOT allows to configure different parameters via URL - like monitoring interval or name of displayed items [item=Files/job1.root/hpxpy&opt=colz&monitoring=1000](https://root.cern/js/latest/httpserver.C/?item=Files/job1.root/hpxpy&opt=colz&monitoring=1000).
105
+
106
+
Some of such parameters can be configured already on the server:
107
+
108
+
serv->SetItemField("/", "_monitoring", "1000"); // monitoring interval in ms
109
+
serv->SetItemField("/", "_drawitem", "Files/job1.root/hpxpy"); // item to draw
110
+
serv->SetItemField("/", "_drawopt", "colz");
111
+
112
+
In such case URL parameters are not required - specified item will be displayed automatically when web page is opened.
113
+
One also can configure to display several items at once. For that one also can configure layout of the drtawing area:
114
+
115
+
serv->SetItemField("/", "_layout", "grid2x2"); // layout for drawing area
serv->SetItemField("/", "_toptitle", "Custom title"); // title of web page, shown when browser off
123
+
124
+
If necessary, one also can automatically open ROOT file when web page is opened:
125
+
126
+
serv->SetItemField("/", "_loadfile", "currentdir/hsimple.root"); // name of ROOT file to load
127
+
128
+
102
129
## Configuring user access
103
130
104
131
By default, the http server is open for anonymous access. One could restrict the access to the server for authenticated users only. First of all, one should create a password file, using the **htdigest** utility.
@@ -152,6 +179,12 @@ One could specify a debug parameter to be able to adjust the FastCGI configurati
152
179
153
180
serv->CreateEngine("fastcgi:9000?debug=1");
154
181
182
+
By default 10 threads are used to process FastCGI requests. This number can be changed with "thrds" url parameter:
183
+
184
+
serv->CreateEngine("fastcgi:9000?thrds=20");
185
+
186
+
If "thrds=0" specified, the only thread will be use to received and process all requests.
187
+
155
188
All user access will be ruled by the main web server. Authorized account names could be used to configure access restriction in THttpServer.
156
189
157
190
@@ -254,7 +287,7 @@ Then, its representation will look like:
254
287
{
255
288
"_typename" : "TNamed",
256
289
"fUniqueID" : 0,
257
-
"fBits" : 50331656,
290
+
"fBits" : 0,
258
291
"fName" : "obj",
259
292
"fTitle" : "title"
260
293
}
@@ -419,21 +452,20 @@ such kind of requests, which themselvs require data from POST block.
419
452
420
453
To use `multi.json` request from the JavaScript, one should create special 'POST' HTTP request and properly parse it. JSROOT provides special method to do this:
421
454
422
-
var xhr = JSROOT.NewHttpRequest("your_server/multi.json?number=3", "multi", function(res) {
423
-
if (!res) return;
424
-
for (var n=0;n<res.length;++n) {
425
-
console.log('Requested element ', res[n]._typename);
console.log('Requested element ', res[n]._typename);
460
+
// draw('drawid', res[n], 'hist');
461
+
}
430
462
431
-
Here argument "multi" identifies, that server response should be parsed with `JSROOT.parse_multi()` function, which correctly interprets JSON code, produced by `multi.json` request. When sending such request to the server, one should provide list of objects names and not forget "?number=N" parameter in the request URL string.
463
+
Here argument "multi" identifies, that server response should be parsed with `parseMulti()` function, which correctly interprets JSON code, produced by `multi.json` request. When sending such request to the server, one should provide list of objects names and not forget "?number=N" parameter in the request URL string.
432
464
433
465
434
466
## Websockets supports
435
467
436
-
Websockets support available starting from ROOT v6.12.
468
+
Websockets support available starting from ROOT v6.12.
437
469
Minimal example provided in `$ROOTSYS/tutorials/http/ws.C` macro.
438
470
439
471
To work with websockets, subclass of THttpWSHandler should be created and registered to THttpServer:
@@ -444,18 +476,18 @@ To work with websockets, subclass of THttpWSHandler should be created and regist
0 commit comments