#include <FileView.h>
|
| FileView (const std::string &path, const std::string &contentType="text/html") |
|
std::string | render (const std::map< std::string, std::string > &context={}) const override |
| Render the view body.
|
|
std::string | getContentType () const override |
| Return the MIME content type for this view.
|
|
virtual | ~FrameworkView ()=default |
|
virtual void | applyHeaders (HttpResponse &response) const |
| Optional hook to set response headers (e.g., Content-Disposition).
|
|
virtual std::string | render (const nlohmann::json &context) const |
| Optional JSON context hook (used by JsonView or convenience).
|
|
Definition at line 12 of file FileView.h.
◆ FileView()
FileView::FileView |
( |
const std::string & |
path, |
|
|
const std::string & |
contentType = "text/html" |
|
) |
| |
|
inlineexplicit |
◆ getContentType()
std::string FileView::getContentType |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ render()
std::string FileView::render |
( |
const std::map< std::string, std::string > & |
context = {} | ) |
const |
|
inlineoverridevirtual |
Optional context (used by templates).
Implements FrameworkView.
Definition at line 17 of file FileView.h.
17 {}) const override {
19 if (!sm) return "<h1>Storage unavailable</h1>";
20
21 std::string result;
22 if (!sm->readFileString(
filePath, 0, UINT32_MAX, result)) {
23 return "<h1>File not found: " +
filePath +
"</h1>";
24 }
25 return result;
26 }
static constexpr std::uintptr_t getTypeKey()
◆ filePath
std::string FileView::filePath |
|
private |
◆ mimeType
std::string FileView::mimeType |
|
private |
The documentation for this class was generated from the following file: