Applied WebApplication interface changes

This commit is contained in:
0xFEEDC0DE64
2018-09-22 07:23:57 +02:00
parent 70c6dda027
commit cc11f8645b
4 changed files with 13 additions and 8 deletions

View File

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

View File

@@ -4,14 +4,19 @@
class QJsonObject;
class WebServer;
class ProxyApplication : public WebApplication
{
Q_OBJECT
public:
ProxyApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR);
ProxyApplication(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,7 +13,7 @@ QString ProxyPlugin::pluginName() const
return QStringLiteral("proxy");
}
WebApplication *ProxyPlugin::createApplication(const QJsonObject &config) const
WebApplication *ProxyPlugin::createApplication(const QJsonObject &config, WebServer &webServer) const
{
return new ProxyApplication(config);
return new ProxyApplication(config, webServer);
}

View File

@@ -12,5 +12,5 @@ public:
ProxyPlugin(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;
};