NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxHttpRequestHandler.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXHTTPREQUESTHANDLER_H
12 #define CXHTTPREQUESTHANDLER_H
13 
14 #include <QObject>
15 #include "cxVisServices.h"
16 
17 #include "org_custusx_webserver_Export.h"
18 
19 class QHttpRequest;
20 class QHttpResponse;
21 
22 namespace cx
23 {
24 typedef boost::shared_ptr<class RemoteAPI> RemoteAPIPtr;
25 
29 class org_custusx_webserver_EXPORT HttpRequestHandler : public QObject
30 {
31  Q_OBJECT
32 public:
34 public slots:
35  void handle_request(QHttpRequest *req, QHttpResponse *resp);
36 
37 protected:
38  void handle_complete_request(QHttpRequest *req, QHttpResponse *resp);
39  void process_mainpage(QHttpRequest *req, QHttpResponse *resp);
40 
41  void handle_screen(QHttpRequest *req, QHttpResponse *resp);
42  void process_screen(QHttpRequest *req, QHttpResponse *resp);
43 
44  void handle_layout(QHttpRequest *req, QHttpResponse *resp);
45  void process_display(QHttpRequest *req, QHttpResponse *resp);
46  void process_stream(QHttpRequest *req, QHttpResponse *resp);
47  void process_layout(QHttpRequest *req, QHttpResponse *resp);
48 
49  void reply_mainpage(QHttpResponse *resp);
50  void reply_screenshot(QHttpResponse *resp);
51  void reply_notfound(QHttpResponse *resp);
52  void reply_method_not_allowed(QHttpResponse *resp);
53  void reply_layout_list(QHttpResponse *resp);
54  void get_display_image(QHttpResponse *resp);
55  void create_display(QHttpRequest *req, QHttpResponse *resp);
56  void delete_display(QHttpResponse *resp);
57  virtual void create_stream(QHttpRequest *req, QHttpResponse *resp);
58  virtual void delete_stream(QHttpResponse *resp);
59 
60  virtual QString getAdditionalMainPageDescription() const { return ""; }
61 
62 protected:
64 
65 private slots:
66  void onRequestSuccessful();
67 private:
68  struct RequestType
69  {
70  RequestType(QHttpRequest *req_, QHttpResponse *resp_) : req(req_), resp(resp_) {}
71  QHttpRequest *req;
72  QHttpResponse *resp;
73  };
74  QList<RequestType> mRequests;
75 
76 
77  QByteArray generatePNGEncoding(QImage image);
78 
79 };
80 
81 } // namespace cx
82 
83 #endif // CXHTTPREQUESTHANDLER_H
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::HttpRequestHandler
Definition: cxHttpRequestHandler.h:29
cx::RemoteAPIPtr
boost::shared_ptr< class RemoteAPI > RemoteAPIPtr
Definition: cxHttpRequestHandler.h:24
cx::HttpRequestHandler::getAdditionalMainPageDescription
virtual QString getAdditionalMainPageDescription() const
Definition: cxHttpRequestHandler.h:60
cx::HttpRequestHandler::mApi
RemoteAPIPtr mApi
Definition: cxHttpRequestHandler.h:63
cxVisServices.h