Applied WebApplication interface changes

This commit is contained in:
0xFEEDC0DE64
2018-09-22 07:23:29 +02:00
parent 5fdee7e15e
commit 5bd4447e2a
4 changed files with 13 additions and 8 deletions

View File

@@ -1,18 +1,18 @@
#include "helloworldapplication.h"
#include "webserver.h"
#include "httprequest.h"
#include "httpresponse.h"
#include "httpclientconnection.h"
HelloWorldApplication::HelloWorldApplication(const QJsonObject &config, QObject *parent) :
WebApplication(parent)
HelloWorldApplication::HelloWorldApplication(const QJsonObject &config, WebServer &webServer) :
WebApplication(&webServer), m_webServer(webServer)
{
Q_UNUSED(config)
}
void HelloWorldApplication::start()
{
}
void HelloWorldApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request)

View File

@@ -4,14 +4,19 @@
class QJsonObject;
class WebServer;
class HelloWorldApplication : public WebApplication
{
Q_OBJECT
public:
HelloWorldApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR);
HelloWorldApplication(const QJsonObject &config, WebServer &webServer);
void start() Q_DECL_OVERRIDE;
void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE;
private:
WebServer &m_webServer;
};

View File

@@ -13,8 +13,8 @@ QString HelloWorldPlugin::pluginName() const
return QStringLiteral("helloworld");
}
WebApplication *HelloWorldPlugin::createApplication(const QJsonObject &config) const
WebApplication *HelloWorldPlugin::createApplication(const QJsonObject &config, WebServer &webServer) const
{
return new HelloWorldApplication(config);
return new HelloWorldApplication(config, webServer);
}

View File

@@ -12,5 +12,5 @@ public:
HelloWorldPlugin(QObject *parent = Q_NULLPTR);
QString pluginName() const Q_DECL_OVERRIDE;
WebApplication *createApplication(const QJsonObject &config) const Q_DECL_OVERRIDE;
WebApplication *createApplication(const QJsonObject &config, WebServer &webServer) const Q_DECL_OVERRIDE;
};