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