Implemented basic example response
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#include "fileserverapplication.h"
|
||||
|
||||
#include "httprequest.h"
|
||||
#include "httpresponse.h"
|
||||
#include "httpclientconnection.h"
|
||||
|
||||
FileserverApplication::FileserverApplication(const QJsonObject &config, QObject *parent) :
|
||||
WebApplication(parent)
|
||||
{
|
||||
@@ -10,3 +14,11 @@ void FileserverApplication::start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FileserverApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request)
|
||||
{
|
||||
HttpResponse response;
|
||||
response.protocol = request.protocol;
|
||||
response.statusCode = HttpResponse::StatusCode::OK;
|
||||
connection->sendResponse(response, "Hello from FileserverApplication: " + request.path);
|
||||
}
|
||||
|
@@ -12,4 +12,6 @@ public:
|
||||
FileserverApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR);
|
||||
|
||||
void start() Q_DECL_OVERRIDE;
|
||||
|
||||
void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
Reference in New Issue
Block a user