12 #ifndef ROOT_THttpServer 13 #define ROOT_THttpServer 93 void AddLocation(
const char *prefix,
const char *path);
120 void Restrict(
const char *path,
const char *options);
132 const char *
GetItemField(
const char *fullname,
const char *name);
void SetCors(const char *domain="*")
Enable CORS header to ProcessRequests() responses Specified location (typically "*") add as "Access-C...
const char * GetTopName() const
returns name of top item in objects hierarchy
const char * GetItemField(const char *fullname, const char *name)
Bool_t IsReadOnly() const
returns read-only mode
Bool_t IsCors() const
Returns kTRUE if CORS was configured.
TString fTopName
! name of top folder, default - "ROOT"
TList fEngines
! engines which runs http server
void ProcessRequests()
Process submitted requests, must be called from main thread.
Bool_t CreateItem(const char *fullname, const char *title)
TRootSniffer * fSniffer
! sniffer provides access to ROOT objects hierarchy
THttpServer(const char *engine="civetweb:8080")
constructor
#define ClassDef(name, id)
The TNamed class is the base class for all named ROOT classes.
THttpTimer * fTimer
! timer used to access main thread
void SetTimer(Long_t milliSec=100, Bool_t mode=kTRUE)
create timer which will invoke ProcessRequests() function periodically Timer is required to perform a...
TList fLocations
! list of local directories, which could be accessed via server
TString fJSROOTSYS
! location of local JSROOT files
Bool_t SubmitHttp(THttpCallArg *arg, Bool_t can_run_immediately=kFALSE)
Submit HTTP request.
Bool_t Register(const char *subfolder, TObject *obj)
Register object in subfolder.
void SetReadOnly(Bool_t readonly)
Set read-only mode for the server (default on) In read-only server is not allowed to change any ROOT ...
Bool_t CreateEngine(const char *engine)
factory method to create different http engines At the moment two engine kinds are supported: civetwe...
virtual ~THttpServer()
destructor delete all http engines and sniffer
TString fDefaultPage
! file name for default page name
void SetSniffer(TRootSniffer *sniff)
Set TRootSniffer to the server Server takes ownership over sniffer.
Bool_t ExecuteHttp(THttpCallArg *arg)
Execute HTTP request.
TString fDrawPage
! file name for drawing of single element
void AddLocation(const char *prefix, const char *path)
add files location, which could be used in the server one could map some system folder to the server ...
Bool_t Hide(const char *fullname, Bool_t hide=kTRUE)
hides folder or element from web gui
std::mutex fMutex
! mutex to protect list with arguments
virtual void ProcessRequest(THttpCallArg *arg)
Function called for every processed request.
TString fDrawPageCont
! content of draw page
TString fDefaultPageCont
! content of the file content
TString fCors
! CORS (cross-origin resource sharing): sets Access-Control-Allow-Origin for ProcessRequest responses...
Bool_t IsAnyEngine() const
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon=0)
Register command which can be executed from web interface.
Mother of all ROOT objects.
static const char * GetMimeType(const char *path)
Guess mime type base on file extension.
Bool_t Unregister(TObject *obj)
Unregister object.
Long_t fMainThrdId
! id of the main ROOT process
static char * ReadFileContent(const char *filename, Int_t &len)
Reads content of file from the disk.
const char * GetCors() const
Returns specified CORS domain.
Bool_t SetIcon(const char *fullname, const char *iconname)
set name of icon, used in browser together with the item
TList fCallArgs
! submitted arguments
static Bool_t VerifyFilePath(const char *fname)
Checked that filename does not contains relative path below current directory Used to prevent access ...
TString fJSROOT
! location of external JSROOT files
virtual Int_t GetSize() const
void SetDrawPage(const char *filename)
Set file name of HTML page, delivered by the server when objects drawing page is requested from the b...
TRootSniffer * GetSniffer() const
returns pointer on objects sniffer
Bool_t SetItemField(const char *fullname, const char *name, const char *value)
Bool_t IsFileRequested(const char *uri, TString &res) const
Check if file is requested, thread safe.
void Restrict(const char *path, const char *options)
Restrict access to specified object.
void SetDefaultPage(const char *filename)
Set file name of HTML page, delivered by the server when http address is opened in the browser...
void SetTopName(const char *top)
set name of top item in objects hierarchy
void SetJSROOT(const char *location)
Set location of JSROOT to use with the server One could specify address like: https://root.cern.ch/js/3.3/ http://web-docs.gsi.de/~linev/js/3.3/ This allows to get new JSROOT features with old server, reduce load on THttpServer instance, also startup time can be improved When empty string specified (default), local copy of JSROOT is used (distributed with ROOT)
const char * Data() const