WebFramework v3.0.12
Web framework for C++.
Loading...
Searching...
No Matches
BaseExecutor.h
1
7#pragma once
8
9#include "Import/WebFrameworkCore.h"
10
11#include "WebNetwork/HTTPRequest.h"
12#include "WebNetwork/HTTPResponse.h"
13#include "Exceptions/NotImplementedException.h"
14#include "Utility/JSONSettingsParser.h"
15
16namespace framework
17{
21 class WEB_FRAMEWORK_API BaseExecutor
22 {
23 public:
24 enum class executorType
25 {
26 none,
27 stateful,
28 stateless,
29 heavyOperationStateful,
30 heavyOperationStateless
31 };
32
33 public:
34 BaseExecutor() = default;
35
40 virtual void init(const utility::JSONSettingsParser::ExecutorSettings& settings);
41
48 virtual void doPost(HTTPRequest& request, HTTPResponse& response);
49
56 virtual void doGet(HTTPRequest& request, HTTPResponse& response);
57
64 virtual void doHead(HTTPRequest& request, HTTPResponse& response);
65
72 virtual void doPut(HTTPRequest& request, HTTPResponse& response);
73
80 virtual void doDelete(HTTPRequest& request, HTTPResponse& response);
81
87 virtual void doPatch(HTTPRequest& request, HTTPResponse& response);
88
95 virtual void doOptions(HTTPRequest& request, HTTPResponse& response);
96
102 virtual void doTrace(HTTPRequest& request, HTTPResponse& response);
103
109 virtual void doConnect(HTTPRequest& request, HTTPResponse& response);
110
115 virtual void destroy() = 0;
116
124 virtual executorType getType() const = 0;
125
126 virtual ~BaseExecutor() = default;
127 };
128
129 using createExecutorFunction = void* (*)();
130}
131
132#ifdef __LINUX__
137#define DECLARE_EXECUTOR(subclassName) extern "C" __attribute__((visibility("default"))) void* create##subclassName##Instance() \
138{ \
139 return new subclassName(); \
140}
141#else
146#define DECLARE_EXECUTOR(subclassName) extern "C" __declspec(dllexport) void* create##subclassName##Instance() \
147{ \
148 return new subclassName(); \
149}
150#endif
Base class for all executors.
virtual void destroy()=0
virtual executorType getType() const =0
Parsing HTTP request.
Definition HTTPRequest.h:25
HTTPBuilder wrapper.