42 class LauncherHttpRegistry :
44 public std::enable_shared_from_this<LauncherHttpRegistry>
48 virtual ~LauncherHttpRegistry();
51 void setReadToken(
const std::string& token);
52 void setControlToken(
const std::string& token);
53 void setHtmlTemplate(
const std::string& path);
62 const std::string& path,
63 Poco::Net::HTTPServerRequest& req,
64 Poco::Net::HTTPServerResponse& resp)
override;
67 Poco::JSON::Object::Ptr handleStatus();
68 Poco::JSON::Object::Ptr handleProcesses();
69 Poco::JSON::Object::Ptr handleProcess(
const std::string& name);
70 Poco::JSON::Object::Ptr handleProcessAction(
71 const std::string& name,
72 std::function<
bool(
const std::string&)> action,
73 const std::string& errorMessage);
74 Poco::JSON::Object::Ptr handleBulkOp(
76 std::function<
void()> action,
77 const std::string& alreadyMsg,
78 const std::string& initiatedMsg);
79 Poco::JSON::Object::Ptr handleStopAll();
80 Poco::JSON::Object::Ptr handleHealth();
81 Poco::JSON::Object::Ptr handleGroups();
82 Poco::JSON::Object::Ptr handleHelp();
84 Poco::JSON::Object::Ptr processToJSON(
const ProcessInfo& proc);
85 Poco::JSON::Object::Ptr groupToJSON(
const ProcessGroup& group);
88 bool checkReadAuth(
const Poco::Net::HTTPServerRequest& req);
89 bool checkControlAuth(
const Poco::Net::HTTPServerRequest& req);
91 static bool validateBearerToken(
const Poco::Net::HTTPServerRequest& req,
92 const std::string& expectedToken);
95 bool sendStaticFile(
const std::string& filename,
96 const std::string& contentType,
98 Poco::Net::HTTPServerRequest& req,
99 Poco::Net::HTTPServerResponse& resp);
100 std::string findFile(
const std::string& filename);
101 std::string applyTemplateVars(
const std::string& content);
104 std::string readToken_;
105 std::string controlToken_;
106 std::string htmlTemplatePath_;
108 std::mutex bulkThreadMutex_;
109 std::thread bulkOpThread_;
Определения UHttpRequestHandler.h:87