Warning, file /include/root/THttpWSHandler.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_THttpWSHandler
0013 #define ROOT_THttpWSHandler
0014
0015 #include "TNamed.h"
0016 #include "THttpCallArg.h"
0017
0018 #include <vector>
0019 #include <memory>
0020 #include <mutex>
0021
0022 class THttpWSEngine;
0023 class THttpServer;
0024
0025 class THttpWSHandler : public TNamed {
0026
0027 friend class THttpServer;
0028
0029 private:
0030 Bool_t fSyncMode{kTRUE};
0031 Bool_t fDisabled{kFALSE};
0032 Int_t fSendCnt{0};
0033 std::mutex fMutex;
0034 std::vector<std::shared_ptr<THttpWSEngine>> fEngines;
0035
0036 std::shared_ptr<THttpWSEngine> FindEngine(UInt_t id, Bool_t book_send = kFALSE);
0037
0038 Bool_t HandleWS(std::shared_ptr<THttpCallArg> &arg);
0039
0040 Int_t RunSendingThrd(std::shared_ptr<THttpWSEngine> engine);
0041
0042 Int_t PerformSend(std::shared_ptr<THttpWSEngine> engine);
0043
0044 void RemoveEngine(std::shared_ptr<THttpWSEngine> &engine, Bool_t terminate = kFALSE);
0045
0046 Int_t CompleteSend(std::shared_ptr<THttpWSEngine> &engine);
0047
0048 protected:
0049
0050 THttpWSHandler(const char *name, const char *title, Bool_t syncmode = kTRUE);
0051
0052
0053 virtual void CompleteWSSend(UInt_t) {}
0054
0055
0056 virtual Bool_t ProcessBatchHolder(std::shared_ptr<THttpCallArg> &) { return kFALSE; }
0057
0058
0059
0060 virtual void VerifyDefaultPageContent(std::shared_ptr<THttpCallArg> &arg) { arg->AddNoCacheHeader(); }
0061
0062
0063 virtual std::string GetCodeVersion() { return ""; }
0064
0065 public:
0066 virtual ~THttpWSHandler();
0067
0068
0069
0070
0071
0072 Bool_t IsSyncMode() const { return fSyncMode; }
0073
0074
0075
0076
0077
0078
0079 virtual TString GetDefaultPageContent() { return ""; }
0080
0081
0082 virtual Bool_t CanServeFiles() const { return kFALSE; }
0083
0084
0085 virtual Bool_t AllowMTProcess() const { return kFALSE; }
0086
0087
0088 virtual Bool_t AllowMTSend() const { return kFALSE; }
0089
0090
0091 Bool_t IsDisabled() const { return fDisabled; }
0092
0093
0094 void SetDisabled() { fDisabled = kTRUE; }
0095
0096
0097 Bool_t HasWS(UInt_t wsid) { return !!FindEngine(wsid); }
0098
0099
0100 Int_t GetNumWS();
0101
0102 UInt_t GetWS(Int_t num = 0);
0103
0104 void CloseWS(UInt_t wsid);
0105
0106 Int_t SendWS(UInt_t wsid, const void *buf, int len);
0107
0108 Int_t SendHeaderWS(UInt_t wsid, const char *hdr, const void *buf, int len);
0109
0110 Int_t SendCharStarWS(UInt_t wsid, const char *str);
0111
0112 virtual Bool_t ProcessWS(THttpCallArg *arg) = 0;
0113
0114 ClassDefOverride(THttpWSHandler, 0)
0115 };
0116
0117 #endif