added a dummy (yet) SyncController for testing sync info from iOS

This commit is contained in:
Luis Ángel San Martín
2015-03-26 22:10:51 +01:00
parent a4230699b1
commit e00d76b81a
4 changed files with 128 additions and 76 deletions

View File

@ -0,0 +1,25 @@
#include "synccontroller.h"
#include "QsLog.h"
#include <QUrl>
SyncController::SyncController()
{
}
void SyncController::service(HttpRequest &request, HttpResponse &response)
{
QString path = QUrl::fromPercentEncoding(request.getPath()).toUtf8();
QStringList pathElements = path.split('/');
qulonglong libraryId = pathElements.at(2).toULongLong();
QString postData = QString::fromUtf8(request.getBody());
QLOG_INFO() << "POST DATA: " << postData;
//TODO Process postData and update the comics
response.write("OK",true);
}

View File

@ -0,0 +1,21 @@
#ifndef SYNCCONTROLLER_H
#define SYNCCONTROLLER_H
#include <QObject>
#include "httprequest.h"
#include "httpresponse.h"
#include "httprequesthandler.h"
class SyncController : public HttpRequestHandler {
Q_OBJECT
Q_DISABLE_COPY(SyncController);
public:
/** Constructor */
SyncController();
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response);
};
#endif // SYNCCONTROLLER_H