fix resource parser
This commit is contained in:
parent
84a84b30d0
commit
6a52f7031e
@ -90,6 +90,7 @@ void RestServer::processHttpRequest(const QUuid &clientId, const HttpRequest &re
|
||||
reply->setClientId(clientId);
|
||||
m_webserver->sendHttpReply(reply);
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
// process request in corresponding resource
|
||||
@ -104,7 +105,6 @@ void RestServer::processHttpRequest(const QUuid &clientId, const HttpRequest &re
|
||||
}
|
||||
m_webserver->sendHttpReply(reply);
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
void RestServer::asyncReplyFinished()
|
||||
|
||||
@ -76,28 +76,6 @@ WebServer::~WebServer()
|
||||
this->close();
|
||||
}
|
||||
|
||||
void WebServer::sendData(const QUuid &clientId, const QVariantMap &data)
|
||||
{
|
||||
QSslSocket *socket = m_clientList.value(clientId);
|
||||
HttpReply reply(HttpReply::Ok);
|
||||
reply.setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";");
|
||||
reply.setPayload(QJsonDocument::fromVariant(data).toJson());
|
||||
reply.packReply();
|
||||
writeData(socket, reply.data());
|
||||
}
|
||||
|
||||
void WebServer::sendData(const QList<QUuid> &clients, const QVariantMap &data)
|
||||
{
|
||||
foreach (const QUuid &client, clients) {
|
||||
QSslSocket *socket = m_clientList.value(client);
|
||||
HttpReply reply(HttpReply::Ok);
|
||||
reply.setHeader(HttpReply::ContentTypeHeader, "application/json; charset=\"utf-8\";");
|
||||
reply.setPayload(QJsonDocument::fromVariant(data).toJson());
|
||||
reply.packReply();
|
||||
writeData(socket, reply.data());
|
||||
}
|
||||
}
|
||||
|
||||
void WebServer::sendHttpReply(HttpReply *reply)
|
||||
{
|
||||
QSslSocket *socket = 0;
|
||||
|
||||
@ -45,8 +45,6 @@ public:
|
||||
explicit WebServer(QObject *parent = 0);
|
||||
~WebServer();
|
||||
|
||||
void sendData(const QUuid &clientId, const QVariantMap &data);
|
||||
void sendData(const QList<QUuid> &clients, const QVariantMap &data);
|
||||
void sendHttpReply(HttpReply *reply);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user