18#include <drogon/utils/HttpConstraint.h>
20#include <trantor/utils/Logger.h>
24#define PATH_LIST_BEGIN \
25 static void initPathRouting() \
27#define PATH_ADD(path, ...) registerSelf__(path, {__VA_ARGS__})
28#define PATH_LIST_END }
47 const HttpRequestPtr &req,
48 std::function<
void(
const HttpResponsePtr &)> &&callback) = 0;
62template <
typename T,
bool AutoCreation = true>
66 static const bool isAutoCreation = AutoCreation;
68 virtual ~HttpSimpleController()
73 HttpSimpleController()
77 static void registerSelf__(
78 const std::string &path,
79 const std::vector<internal::HttpConstraint> &constraints)
81 LOG_TRACE <<
"register simple controller("
82 << HttpSimpleController<T, AutoCreation>::classTypeName()
83 <<
") on path:" << path;
86 HttpSimpleController<T, AutoCreation>::classTypeName(),
103 friend pathRegistrator;
104 static pathRegistrator registrator_;
106 virtual void *touch()
108 return ®istrator_;
112template <
typename T,
bool AutoCreation>
113typename HttpSimpleController<T, AutoCreation>::pathRegistrator
114 HttpSimpleController<T, AutoCreation>::registrator_;
The base class for all drogon reflection classes.
Definition DrObject.h:34
virtual HttpAppFramework & registerHttpSimpleController(const std::string &pathName, const std::string &ctrlName, const std::vector< internal::HttpConstraint > &constraints={})=0
Register a HttpSimpleController object into the framework.
The abstract base class for HTTP simple controllers.
Definition HttpSimpleController.h:37
virtual void asyncHandleHttpRequest(const HttpRequestPtr &req, std::function< void(const HttpResponsePtr &)> &&callback)=0
The function is called when a HTTP request is routed to the controller.
Drogon Test is a minimal effort test framework developed because the major C++ test frameworks doesn'...
Definition Attribute.h:23
HttpAppFramework & app()
A wrapper of the instance() method.
Definition HttpAppFramework.h:1656