Applied WebApplication interface changes
This commit is contained in:
@@ -1,18 +1,18 @@
|
|||||||
#include "helloworldapplication.h"
|
#include "helloworldapplication.h"
|
||||||
|
|
||||||
|
#include "webserver.h"
|
||||||
#include "httprequest.h"
|
#include "httprequest.h"
|
||||||
#include "httpresponse.h"
|
#include "httpresponse.h"
|
||||||
#include "httpclientconnection.h"
|
#include "httpclientconnection.h"
|
||||||
|
|
||||||
HelloWorldApplication::HelloWorldApplication(const QJsonObject &config, QObject *parent) :
|
HelloWorldApplication::HelloWorldApplication(const QJsonObject &config, WebServer &webServer) :
|
||||||
WebApplication(parent)
|
WebApplication(&webServer), m_webServer(webServer)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelloWorldApplication::start()
|
void HelloWorldApplication::start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelloWorldApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request)
|
void HelloWorldApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request)
|
||||||
|
@@ -4,14 +4,19 @@
|
|||||||
|
|
||||||
class QJsonObject;
|
class QJsonObject;
|
||||||
|
|
||||||
|
class WebServer;
|
||||||
|
|
||||||
class HelloWorldApplication : public WebApplication
|
class HelloWorldApplication : public WebApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelloWorldApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR);
|
HelloWorldApplication(const QJsonObject &config, WebServer &webServer);
|
||||||
|
|
||||||
void start() Q_DECL_OVERRIDE;
|
void start() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE;
|
void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
WebServer &m_webServer;
|
||||||
};
|
};
|
||||||
|
@@ -13,8 +13,8 @@ QString HelloWorldPlugin::pluginName() const
|
|||||||
return QStringLiteral("helloworld");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,5 +12,5 @@ public:
|
|||||||
HelloWorldPlugin(QObject *parent = Q_NULLPTR);
|
HelloWorldPlugin(QObject *parent = Q_NULLPTR);
|
||||||
|
|
||||||
QString pluginName() const Q_DECL_OVERRIDE;
|
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;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user