15#pragma GCC diagnostic ignored "-Wunused-parameter"
16#pragma GCC diagnostic ignored "-Wshadow"
26#include "include/base/cef_bind.h"
27#include "include/cef_app.h"
28#include "include/cef_version.h"
29#include "include/views/cef_browser_view.h"
30#include "include/views/cef_window.h"
31#include "include/wrapper/cef_closure_task.h"
32#include "include/wrapper/cef_helpers.h"
33#include "include/cef_parser.h"
34#include "include/wrapper/cef_stream_resource_handler.h"
70 if (window) window->SetTitle(title);
127 return std::string(
"data:") +
mime_type +
";base64," +
151 printf(
"Fail to load URL %s\n",
failedUrl.ToString().substr(0,100).c_str());
174 std::string
src =
source.ToString().substr(0,100);
215 const char *
GetWSKind()
const override {
return "longpoll"; }
241 std::shared_ptr<TCefHttpCallArg>
fArg;
250 fArg = std::make_shared<TCefHttpCallArg>();
262 fArg->AssignCallback(callback);
265 callback->Continue();
270#if CEF_VERSION_MAJOR > 114
279 response->SetMimeType(
"text/html");
280 response->SetStatus(404);
283 response->SetMimeType(
fArg->GetContentType());
284 response->SetStatus(200);
287 if (
fArg->NumHeader() > 0) {
288 CefResponse::HeaderMap
headers;
294 response->SetHeaderMap(
headers);
304 if (!
fArg)
return false;
309 char *data_ = (
char *)
fArg->GetContent();
338 std::string
addr = request->GetURL().ToString();
339 std::string prefix =
"http://rootserver.local";
341 if (
addr.compare(0, prefix.length(), prefix) != 0)
344 int indx = std::stoi(
addr.substr(prefix.length(),
addr.find(
"/", prefix.length()) - prefix.length()));
352 if (
serv->IsZombie()) {
383 std::string
inp_method = request->GetMethod().ToString();
388 handler->
fArg->SetTopName(
"webgui");
398 CefPostData::ElementVector elements;
400 size_t sz = 0, off = 0;
401 for (
unsigned n = 0;
n < elements.size(); ++
n)
406 for (
unsigned n = 0;
n < elements.size(); ++
n) {
410 handler->
fArg->SetPostData(std::move(
data));
415 handler->
fArg->SetPostData(std::string(buf.
Data()));
432 std::string
url =
"file:///batch_page";
454 return std::string(
"http://rootserver.local") + std::to_string(
indx) +
addr;
#define R__LOG_WARNING(...)
#define R__LOG_ERROR(...)
#define R__LOG_DEBUG(DEBUGLEVEL,...)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
CefRefPtr< CefResourceManager > fResourceManager
int fConsole
! console parameter, assigned via WebGui.Console rootrc parameter
GuiHandler(bool use_views=false)
std::vector< THttpServer * > fServers
void OnBeforeClose(CefRefPtr< CefBrowser > browser) override
CefRefPtr< CefResourceHandler > GetResourceHandler(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request) override
bool DoClose(CefRefPtr< CefBrowser > browser) override
void CloseAllBrowsers(bool force_close)
void PlatformTitleChange(CefRefPtr< CefBrowser > browser, const CefString &title)
cef_return_value_t OnBeforeResourceLoad(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, CefRefPtr< CefRequest > request, CefRefPtr< CefCallback > callback) override
void OnLoadError(CefRefPtr< CefBrowser > browser, CefRefPtr< CefFrame > frame, ErrorCode errorCode, const CefString &errorText, const CefString &failedUrl) override
static std::string GetDataURI(const std::string &data, const std::string &mime_type)
bool fUseViews
! if view framework is used, required for true headless mode
std::string AddBatchPage(const std::string &cont)
Generate URL for batch page Uses file:/// prefix to let access JSROOT scripts placed on file system R...
std::string MakePageUrl(THttpServer *serv, const std::string &addr)
Generate URL for RWebWindow page Register server instance and assign it with the index Produced URL o...
bool OnConsoleMessage(CefRefPtr< CefBrowser > browser, cef_log_severity_t level, const CefString &message, const CefString &source, int line) override
void OnTitleChange(CefRefPtr< CefBrowser > browser, const CefString &title) override
void OnAfterCreated(CefRefPtr< CefBrowser > browser) override
A log configuration for a channel, e.g.
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
void AssignCallback(CefRefPtr< CefCallback > cb)
void HttpReplied() override
virtual method to inform object that http request is processed
const char * GetWSPlatform() const override
provide WS platform
CefRefPtr< CefCallback > fCallBack
const char * GetWSKind() const override
provide WS kind
TCefHttpCallArg()=default
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
~TGuiResourceHandler() override
bool ProcessRequest(CefRefPtr< CefRequest > request, CefRefPtr< CefCallback > callback) override
DISALLOW_COPY_AND_ASSIGN(TGuiResourceHandler)
std::shared_ptr< TCefHttpCallArg > fArg
IMPLEMENT_REFCOUNTING(TGuiResourceHandler)
bool ReadResponse(void *data_out, int bytes_to_read, int &bytes_read, CefRefPtr< CefCallback > callback) override
TGuiResourceHandler(THttpServer *serv, bool dummy=false)
void GetResponseHeaders(CefRefPtr< CefResponse > response, int64 &response_length, CefString &redirectUrl) override
Contains arguments for single HTTP call.
const void * GetContent() const
void SetContent(const char *cont)
Set content as text.
Online http server for arbitrary ROOT application.
Bool_t SubmitHttp(std::shared_ptr< THttpCallArg > arg, Bool_t can_run_immediately=kFALSE)
Submit HTTP request.
static char * ReadFileContent(const char *filename, Int_t &len)
Reads content of file from the disk.
static const char * GetMimeType(const char *path)
Guess mime type base on file extension.
const char * Data() const
This class represents a WWW compatible URL.
ROOT::Experimental::RLogChannel & CefWebDisplayLog()
ROOT::Experimental::RLogChannel & CefWebDisplayLog()