diff --git a/proxyapplication.cpp b/proxyapplication.cpp index 84f721c..fdc4759 100644 --- a/proxyapplication.cpp +++ b/proxyapplication.cpp @@ -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) diff --git a/proxyapplication.h b/proxyapplication.h index 82be796..1a2db84 100644 --- a/proxyapplication.h +++ b/proxyapplication.h @@ -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; }; diff --git a/proxyplugin.cpp b/proxyplugin.cpp index 71cc0f8..6dc164e 100644 --- a/proxyplugin.cpp +++ b/proxyplugin.cpp @@ -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); } diff --git a/proxyplugin.h b/proxyplugin.h index 97ed5da..0f9758c 100644 --- a/proxyplugin.h +++ b/proxyplugin.h @@ -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; };