hyperion.ng
StaticFileServing.h
1 #ifndef STATICFILESERVING_H
2 #define STATICFILESERVING_H
3 
4 #include <QMimeDatabase>
5 
6 //#include "QtHttpServer.h"
7 #include "QtHttpRequest.h"
8 #include "QtHttpReply.h"
9 #include "QtHttpHeader.h"
10 #include "CgiHandler.h"
11 
12 #include <utils/Logger.h>
13 
14 class StaticFileServing : public QObject {
15  Q_OBJECT
16 
17 public:
18  explicit StaticFileServing (QObject * parent = nullptr);
19  virtual ~StaticFileServing (void);
20 
24  void setBaseUrl(const QString& url);
29  void setSSDPDescription(const QString& desc);
30 
31 public slots:
32  void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply);
33 
34 private:
35  QString _baseUrl;
36  QMimeDatabase * _mimeDb;
37  CgiHandler _cgi;
38  Logger * _log;
39  QByteArray _ssdpDescription;
40 
41  void printErrorToReply (QtHttpReply * reply, QtHttpReply::StatusCode code, QString errorMessage);
42 
43 };
44 
45 #endif // STATICFILESERVING_H
Definition: Logger.h:32
void setBaseUrl(const QString &url)
Overwrite current base url.
Definition: StaticFileServing.cpp:29
void setSSDPDescription(const QString &desc)
Set a new SSDP description, if empty the description will be unset and clients will get a NotFound...
Definition: StaticFileServing.cpp:35
Definition: CgiHandler.h:13
Definition: QtHttpRequest.h:17
Definition: StaticFileServing.h:14
Definition: QtHttpReply.h:11