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