this class allow you to set any file of filesystem as response body
More...
#include <file_handler.h>
|
| static bool | loadFile (const char *filePath, std::string &data) |
| |
this class allow you to set any file of filesystem as response body
FileHandler can handle as text files (like css, js), as binary data (img, png others)
| FileHandler::FileHandler |
( |
const char * |
route, |
|
|
const char * |
filePath, |
|
|
const char * |
mimeType, |
|
|
bool |
isBinary |
|
) |
| |
create file handlers with specified uri route, file path, content type etc.
- Parameters
-
| route | uri route file |
| filePath | local file path |
| mimeType | content type |
| isBinary | if file is binary, set true, false if it's text. |
| void FileHandler::exec |
( |
| ) |
|
|
overridevirtual |
make http body of response object as file in filePath
Implements Handler.
| static bool FileHandler::loadFile |
( |
const char * |
filePath, |
|
|
std::string & |
data |
|
) |
| |
|
static |
static function that read all data from file to string
- Parameters
-
| filePath | path to file |
| data | out param, if can read file, it will be written to data,do nothing otherwise |
- Returns
- true, if read successfully, false otherwise
The documentation for this class was generated from the following file: