Update QtWebapp to 1.7.11

This commit is contained in:
Felix Kauselmann
2020-07-30 12:28:05 +02:00
parent 3de099491f
commit b9c48cc4b6
31 changed files with 796 additions and 307 deletions

View File

@ -13,6 +13,8 @@
#include "httpresponse.h"
#include "httprequesthandler.h"
namespace stefanfrings {
/**
Delivers static files. It is usually called by the applications main request handler when
the caller requests a path that is mapped to static files.
@ -45,11 +47,20 @@ class DECLSPEC StaticFileController : public HttpRequestHandler {
Q_DISABLE_COPY(StaticFileController)
public:
/** Constructor */
StaticFileController(QSettings* settings, QObject* parent = nullptr);
/**
Constructor.
@param settings Configuration settings, usually stored in an INI file. Must not be 0.
Settings are read from the current group, so the caller must have called settings->beginGroup().
Because the group must not change during runtime, it is recommended to provide a
separate QSettings instance that is not used by other parts of the program.
The StaticFileController does not take over ownership of the QSettings instance, so the
caller should destroy it during shutdown.
@param parent Parent object
*/
StaticFileController(const QSettings* settings, QObject* parent = nullptr);
/** Generates the response */
void service(HttpRequest& request, HttpResponse& response) override;
void service(HttpRequest& request, HttpResponse& response);
private:
@ -81,14 +92,9 @@ private:
QMutex mutex;
/** Set a content-type header in the response depending on the ending of the filename */
void setContentType(QString file, HttpResponse& response) const;
//YACReader------------------------------------------------------------------------
QString getLocalizedFileName(QString fileName, QString locales, QString path) const;
QString getDeviceAwareFileName(QString fileName, QString device, QString locales, QString path) const;
QString getDeviceAwareFileName(QString fileName, QString device, QString display, QString locales, QString path) const;
bool exists(QString localizedName, QString path) const;
void setContentType(const QString file, HttpResponse &response) const;
};
} // end of namespace
#endif // STATICFILECONTROLLER_H