forked from dedis/Dissent
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetMessagesService.hpp
46 lines (35 loc) · 1.13 KB
/
GetMessagesService.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef DISSENT_WEB_GET_MESSAGES_SERVICE_GUARD
#define DISSENT_WEB_GET_MESSAGES_SERVICE_GUARD
#include <QByteArray>
#include <QList>
#include "MessageWebService.hpp"
namespace Dissent {
namespace Web {
/**
* Web service for getting the WebServer target messages from
* message cache. Get total k number of messages from the beginning of i'th entered message to the (i+k-1)th message.
*/
class GetMessagesService : public MessageWebService {
public:
explicit GetMessagesService()
{
}
virtual ~GetMessagesService() {}
/**
* Called to handle the incoming request
* @param request the incoming request
* @param response used to respond to the rqeuest
*/
virtual void HandleRequest(QHttpRequest *request, QHttpResponse *response);
private:
virtual void HandleMessage(const QByteArray &data);
typedef QPair<QHttpRequest *, QHttpResponse *> ReqRep;
QList<ReqRep> m_pending;
QList<QByteArray> m_message_list;
static const QString OFFSET_FIELD;
static const QString COUNT_FIELD;
static const QString WAIT_FIELD;
};
}
}
#endif