12 #ifndef ROOT_THttpServer 13 #define ROOT_THttpServer 56 std::queue<std::shared_ptr<THttpCallArg>>
fArgs;
91 void SetCors(
const std::string &domain =
"*") { fCors = domain; }
97 const char *
GetCors()
const {
return fCors.c_str(); }
107 void AddLocation(
const char *prefix,
const char *path);
111 void SetDrawPage(
const std::string &filename =
"");
122 Bool_t ExecuteHttp(std::shared_ptr<THttpCallArg> arg);
128 Bool_t SubmitHttp(std::shared_ptr<THttpCallArg> arg,
Bool_t can_run_immediately =
kFALSE);
131 void ProcessRequests();
140 void Restrict(
const char *path,
const char *options);
142 Bool_t RegisterCommand(
const char *cmdname,
const char *method,
const char *icon = 0);
146 Bool_t SetIcon(
const char *fullname,
const char *iconname);
148 Bool_t CreateItem(
const char *fullname,
const char *title);
150 Bool_t SetItemField(
const char *fullname,
const char *
name,
const char *value);
152 const char *GetItemField(
const char *fullname,
const char *name);
155 static const char *GetMimeType(
const char *path);
158 static char *ReadFileContent(
const char *filename,
Int_t &len);
161 static std::string ReadFileContent(
const std::string &filename);
Bool_t IsTerminated() const
returns kTRUE, if server was terminated
std::string fDrawPageCont
! content of draw html page
void SetDrawPage(const std::string &filename="")
Set file name of HTML page, delivered by the server when objects drawing page is requested from the b...
const char * GetTopName() const
returns name of top item in objects hierarchy
virtual void MissedRequest(THttpCallArg *arg)
Method called when THttpServer cannot process request By default such requests replied with 404 code ...
Bool_t IsReadOnly() const
returns read-only mode
virtual void ProcessRequest(std::shared_ptr< THttpCallArg > arg)
Process single http request Depending from requested path and filename different actions will be perf...
Bool_t IsCors() const
Returns kTRUE if CORS was configured.
TString fTopName
! name of top folder, default - "ROOT"
void SetDefaultPage(const std::string &filename="")
Set file name of HTML page, delivered by the server when http address is opened in the browser...
TList fEngines
! engines which runs http server
Bool_t fTerminated
! termination flag, disables all requests processing
TRootSniffer * fSniffer
! sniffer provides access to ROOT objects hierarchy
THttpServer(const char *engine="civetweb:8080")
constructor
std::queue< std::shared_ptr< THttpCallArg > > fArgs
! submitted arguments
#define ClassDef(name, id)
void SetTerminate()
set termination flag, no any further requests will be processed
The TNamed class is the base class for all named ROOT classes.
THttpTimer * fTimer
! timer used to access main thread
#define _R__DEPRECATED_618(REASON)
void SetCors(const std::string &domain="*")
Enable CORS header to ProcessRequests() responses Specified location (typically "*") add as "Access-C...
void SetTimer(Long_t milliSec=100, Bool_t mode=kTRUE)
create timer which will invoke ProcessRequests() function periodically Timer is required to perform a...
TString fJSROOTSYS
! location of local JSROOT files
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...
std::string fDrawPage
! file name for drawing of single element
std::map< std::string, std::string > fLocations
! list of local directories, which could be accessed via server
virtual ~THttpServer()
destructor delete all http engines and sniffer
RooCmdArg Restrict(const char *catName, const char *stateNameList)
void SetSniffer(TRootSniffer *sniff)
Set TRootSniffer to the server Server takes ownership over sniffer.
std::string fCors
! CORS: sets Access-Control-Allow-Origin header for ProcessRequest responses
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 ...
std::mutex fMutex
! mutex to protect list with arguments
std::string fDefaultPage
! file name for default page name
Bool_t IsAnyEngine() const
Mother of all ROOT objects.
Long_t fMainThrdId
! id of the main ROOT process
const char * GetCors() const
Returns specified CORS domain.
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 ...
std::string fDefaultPageCont
! content of default html page
TString fJSROOT
! location of external JSROOT files
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TRootSniffer * GetSniffer() const
returns pointer on objects sniffer
Bool_t IsFileRequested(const char *uri, TString &res) const
Check if file is requested, thread safe.
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