Go to the documentation of this file.00001
00006 #ifndef STATICFILECONTROLLER_H
00007 #define STATICFILECONTROLLER_H
00008
00009 #include "httprequest.h"
00010 #include "httpresponse.h"
00011 #include "httprequesthandler.h"
00012 #include <QCache>
00013
00041 class StaticFileController : public HttpRequestHandler {
00042 Q_OBJECT
00043 Q_DISABLE_COPY(StaticFileController);
00044 public:
00045
00047 StaticFileController(QSettings* settings, QObject* parent = 0);
00048
00050 void service(HttpRequest& request, HttpResponse& response);
00051
00052 private:
00053
00055 QString encoding;
00056
00058 QString docroot;
00059
00061 int maxAge;
00062
00063 struct CacheEntry {
00064 QByteArray document;
00065 qint64 created;
00066 };
00067
00069 int cacheTimeout;
00070
00072 int maxCachedFileSize;
00073
00075 QCache<QString,CacheEntry> cache;
00076
00078 void setContentType(QString file, HttpResponse& response) const;
00079 };
00080
00081 #endif // STATICFILECONTROLLER_H