tufao
0.8.1
An asynchronous web framework for C++ built on top of Qt
|
This class provides a plugin-based request handler. More...
Public Slots | |
bool | handleRequest (Tufao::HttpServerRequest *request, Tufao::HttpServerResponse *response, const QStringList &args=QStringList()) |
Handle the request using the loaded plugins and rules. | |
void | reloadConfig () |
Clear all previous mappings and reload all rules and plugins. More... | |
Public Slots inherited from Tufao::AbstractHttpServerRequestHandler | |
virtual bool | handleRequest (Tufao::HttpServerRequest *request, Tufao::HttpServerResponse *response, const QStringList &args=QStringList())=0 |
Handles the request using the response object. More... | |
Public Member Functions | |
HttpPluginServer (const QString &configFile=QString(), QObject *parent=0) | |
Constructs a HttpPluginServer object. More... | |
HttpPluginServer (const QString &configFile, bool autoreload, QObject *parent=0) | |
Constructs a HttpPluginServer object. More... | |
~HttpPluginServer () | |
Destroys the object. | |
void | setConfig (const QString &file) |
This is an overloaded function. More... | |
void | setConfig (const QString &file, bool autoreload) |
Set the configuration file used to handle requests. More... | |
QString | config () const |
Return the current used configuration file. More... | |
Public Member Functions inherited from Tufao::AbstractHttpServerRequestHandler | |
AbstractHttpServerRequestHandler (QObject *parent=0) | |
Constructs an AbstractHttpServerRequestHandler object. | |
This class provides a plugin-based request handler.
Use it if you need to change the running server code without need to restart the appplication.
It maintains its own set of rules and is as powerful as HttpServerRequestRouter (and internally uses it), but, in contrast, exports its configuration through a file and will use handlers loaded from plugins.
The file use a syntax based on the QSettings ini format and can edit it using tufao-routes-editor.
|
explicit |
Constructs a HttpPluginServer object.
configFile | It's used as configuration file. |
parent | It's passed to the QObject constructor. |
|
explicit |
Constructs a HttpPluginServer object.
configFile | It's used as configuration file. |
autoreload | Whether HttpPluginServer will autoreload the config file when it is modified. |
parent | It's passed to the QObject constructor. |
QString Tufao::HttpPluginServer::config | ( | ) | const |
Return the current used configuration file.
This file is used to handle requests, loading the appropriate plugins, generating actual handlers and mapping them to the rules described in this file.
|
slot |
Clear all previous mappings and reload all rules and plugins.
If you want to control when the plugins are reloaded, you must ensure that autoreload is false and explicitly call this slot when you want to make the changes of the config file take effect.
This is an advanced use of HttpPluginServer and you probably just want to ensure autoreload is true to avoid unnecessary complexities.
void Tufao::HttpPluginServer::setConfig | ( | const QString & | file | ) |
This is an overloaded function.
It will NOT autoreload the config referenced by file
.
void Tufao::HttpPluginServer::setConfig | ( | const QString & | file, |
bool | autoreload | ||
) |
Set the configuration file used to handle requests.
Call this function will reload the configuration.
autoreload
tells whether HttpPluginServer should autoreload the config file when it is modified.