SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
staticfilecontroller.h
Go to the documentation of this file.
1 
6 #ifndef STATICFILECONTROLLER_H
7 #define STATICFILECONTROLLER_H
8 
9 #include <QCache>
10 #include <QMutex>
11 #include "httpglobal.h"
12 #include "httprequest.h"
13 #include "httpresponse.h"
14 #include "httprequesthandler.h"
15 
16 #include "export.h"
17 
18 namespace qtwebapp {
19 
47 class HttpDocrootSettings;
48 
50  Q_OBJECT
51  Q_DISABLE_COPY(StaticFileController)
52 public:
53 
55  StaticFileController(QSettings* settings, QObject* parent = NULL);
56 
58  StaticFileController(const HttpDocrootSettings& settings, QObject* parent = NULL);
59 
61  void service(HttpRequest& request, HttpResponse& response);
62 
64  void service(QByteArray& path, HttpResponse& response);
65 
66 private:
67 
69  QString encoding;
70 
72  QString docroot;
73 
75  int maxAge;
76 
77  struct CacheEntry {
78  QByteArray document;
79  qint64 created;
80  QByteArray filename;
81  };
82 
85 
88 
90  QCache<QString,CacheEntry> cache;
91 
93  QMutex mutex;
94 
97 
99  void setContentType(QString file, HttpResponse& response) const;
100 };
101 
102 } // end of namespace
103 
104 #endif // STATICFILECONTROLLER_H
QCache< QString, CacheEntry > cache
#define HTTPSERVER_API
Definition: export.h:88