Class HttpSimpleController
Synopsis
#include <lib/inc/drogon/HttpSimpleController.h>
template <typename T, bool AutoCreation = true>
class HttpSimpleController : public DrObject<T>, public HttpSimpleControllerBase
Description
The reflection base class template for HTTP simple controllers.
- Template Parameters
T
- The type of the implementation classAutoCreation
- The flag for automatically creating, user can set this flag to false for classes that have nondefault constructors.
Mentioned in
- Getting Started / A very simple example
- Quick Start / Dynamic Site
- Controller Introduction / Controller
- Controller Introduction / Controller HttpSimpleController
- Controller Introduction / Controller HttpController / Usage
- Controller Introduction / Controller WebSocketController / WebSocketController
- Configuration File / simple_controllers_map
- Drogon Ctl Command / Create sub command
- Drogon Ctl Command / Controller creation
- Benchmarks / Test plan and results
Inheritance
Ancestors: DrObject, HttpSimpleControllerBase
Methods
HttpSimpleController | ||
~HttpSimpleController | ||
registerSelf__ |
Source
Lines 60-102 in lib/inc/drogon/HttpSimpleController.h.
template <typename T, bool AutoCreation = true>
class HttpSimpleController : public DrObject<T>, public HttpSimpleControllerBase
{
public:
static const bool isAutoCreation = AutoCreation;
virtual ~HttpSimpleController()
{
}
protected:
HttpSimpleController()
{
}
static void registerSelf__(
const std::string &path,
const std::vector<internal::HttpConstraint> &filtersAndMethods)
{
LOG_TRACE << "register simple controller("
<< HttpSimpleController<T>::classTypeName()
<< ") on path:" << path;
app().registerHttpSimpleController(
path, HttpSimpleController<T>::classTypeName(), filtersAndMethods);
}
private:
class pathRegistrator
{
public:
pathRegistrator()
{
if (AutoCreation)
{
T::initPathRouting();
}
}
};
friend pathRegistrator;
static pathRegistrator registrator_;
virtual void *touch()
{
return ®istrator_;
}
};