/// \file RWebWindowWSHandler.hxx /// \ingroup WebGui ROOT7 /// \author Sergey Linev /// \date 2018-08-20 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback /// is welcome! /************************************************************************* * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT7_RWebWindowWSHandler #define ROOT7_RWebWindowWSHandler #include "THttpWSHandler.h" #include "TEnv.h" #include #include using namespace std::string_literals; namespace ROOT { namespace Experimental { /// just wrapper to deliver websockets call-backs to the RWebWindow class class RWebWindowWSHandler : public THttpWSHandler { protected: Bool_t ProcessBatchHolder(std::shared_ptr &arg) override { return IsDisabled() ? kFALSE : fWindow.ProcessBatchHolder(arg); } void VerifyDefaultPageContent(std::shared_ptr &arg) override { auto version = fWindow.GetClientVersion(); if (!version.empty()) { std::string search = "jsrootsys/scripts/JSRootCore."s; std::string replace = version + "/jsrootsys/scripts/JSRootCore."s; // replace link to JSROOT main script to emulate new version arg->ReplaceAllinContent(search, replace, true); arg->AddNoCacheHeader(); } std::string more_args; const char *ui5source = gEnv->GetValue("WebGui.openui5src",""); if (ui5source && *ui5source) more_args.append("openui5src: \""s + ui5source + "\","s); const char *ui5libs = gEnv->GetValue("WebGui.openui5libs",""); if (ui5libs && *ui5libs) more_args.append("openui5libs: \""s + ui5libs + "\","s); const char *ui5theme = gEnv->GetValue("WebGui.openui5theme",""); if (ui5theme && *ui5theme) more_args.append("openui5theme: \""s + ui5theme + "\","s); auto user_args = fWindow.GetUserArgs(); if (!user_args.empty()) more_args = "user_args: "s + user_args + ","s; if (!more_args.empty()) { std::string search = "JSROOT.ConnectWebWindow({"s; std::string replace = search + more_args; arg->ReplaceAllinContent(search, replace, true); arg->AddNoCacheHeader(); } } public: RWebWindow &fWindow; ///