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.
|
#include <staticfilecontroller.h>
Classes | |
struct | CacheEntry |
Public Member Functions | |
StaticFileController (QSettings *settings, QObject *parent=NULL) | |
StaticFileController (const HttpDocrootSettings &settings, QObject *parent=NULL) | |
void | service (HttpRequest &request, HttpResponse &response) |
void | service (QByteArray &path, HttpResponse &response) |
Public Member Functions inherited from qtwebapp::HttpRequestHandler | |
HttpRequestHandler (QObject *parent=NULL) | |
virtual | ~HttpRequestHandler () |
Private Member Functions | |
void | setContentType (QString file, HttpResponse &response) const |
Private Attributes | |
QString | encoding |
QString | docroot |
int | maxAge |
int | cacheTimeout |
int | maxCachedFileSize |
QCache< QString, CacheEntry > | cache |
QMutex | mutex |
bool | useQtSettings |
Definition at line 49 of file staticfilecontroller.h.
StaticFileController::StaticFileController | ( | QSettings * | settings, |
QObject * | parent = NULL |
||
) |
Constructor with Qt settings
Definition at line 15 of file staticfilecontroller.cpp.
References cache, cacheTimeout, docroot, encoding, maxAge, and maxCachedFileSize.
StaticFileController::StaticFileController | ( | const HttpDocrootSettings & | settings, |
QObject * | parent = NULL |
||
) |
Constructor with settings structure
Definition at line 41 of file staticfilecontroller.cpp.
References cache, qtwebapp::HttpDocrootSettings::cacheSize, qtwebapp::HttpDocrootSettings::cacheTime, cacheTimeout, docroot, qtwebapp::HttpDocrootSettings::encoding, encoding, qtwebapp::HttpDocrootSettings::maxAge, maxAge, qtwebapp::HttpDocrootSettings::maxCachedFileSize, maxCachedFileSize, and qtwebapp::HttpDocrootSettings::path.
|
virtual |
Generates the response from HTTP request
Reimplemented from qtwebapp::HttpRequestHandler.
Definition at line 62 of file staticfilecontroller.cpp.
References qtwebapp::HttpRequest::getPath().
Referenced by WebAPIRequestMapper::service().
void StaticFileController::service | ( | QByteArray & | path, |
HttpResponse & | response | ||
) |
Generates the response directly from the path
Definition at line 68 of file staticfilecontroller.cpp.
References cache, cacheTimeout, qtwebapp::StaticFileController::CacheEntry::created, docroot, qtwebapp::StaticFileController::CacheEntry::document, qtwebapp::StaticFileController::CacheEntry::filename, maxAge, maxCachedFileSize, mutex, setContentType(), qtwebapp::HttpResponse::setHeader(), qtwebapp::HttpResponse::setStatus(), and qtwebapp::HttpResponse::write().
|
private |
Set a content-type header in the response depending on the ending of the filename
Definition at line 154 of file staticfilecontroller.cpp.
References encoding, and qtwebapp::HttpResponse::setHeader().
Referenced by service().
|
private |
Cache storage
Definition at line 90 of file staticfilecontroller.h.
Referenced by service(), and StaticFileController().
|
private |
Timeout for each cached file
Definition at line 84 of file staticfilecontroller.h.
Referenced by service(), and StaticFileController().
|
private |
Root directory of documents
Definition at line 72 of file staticfilecontroller.h.
Referenced by service(), and StaticFileController().
|
private |
Encoding of text files
Definition at line 69 of file staticfilecontroller.h.
Referenced by setContentType(), and StaticFileController().
|
private |
Maximum age of files in the browser cache
Definition at line 75 of file staticfilecontroller.h.
Referenced by service(), and StaticFileController().
|
private |
Maximum size of files in cache, larger files are not cached
Definition at line 87 of file staticfilecontroller.h.
Referenced by service(), and StaticFileController().
|
private |
Used to synchronize cache access for threads
Definition at line 93 of file staticfilecontroller.h.
Referenced by service().
|
private |
Settings flag
Definition at line 96 of file staticfilecontroller.h.