Fawkes API Fawkes Development Version
|
Static web reply. More...
#include <>>
Public Member Functions | |
StaticWebReply (Code code, std::string body="") | |
Constructor. More... | |
void | append_body (const char *format,...) |
Append to body. More... | |
void | append_body (const std::string &s) |
Append string to body. More... | |
StaticWebReply & | operator+= (std::string text) |
Append simple text line. More... | |
virtual const std::string & | body () |
Get body. More... | |
virtual std::string::size_type | body_length () |
Get length of body. More... | |
virtual void | pack () |
Pack the data. More... | |
![]() | |
WebReply (Code code) | |
Constructor. More... | |
virtual | ~WebReply () |
Destructor. More... | |
Code | code () const |
Get response code. More... | |
void | set_code (Code code) |
Set response code. More... | |
void | add_header (const std::string &header, const std::string &content) |
Add a HTTP header. More... | |
void | add_header (const std::string &header_string) |
Add a HTTP header. More... | |
const HeaderMap & | headers () const |
get headers. More... | |
void | set_caching (bool caching) |
Enable or disable caching for this specific reply. More... | |
void | set_request (WebRequest *request) |
Set associated request. More... | |
WebRequest * | get_request () const |
Get associated request. More... | |
void | pack_caching () |
Called just before the reply is sent. More... | |
Protected Attributes | |
std::string | _body |
Body of the reply. More... | |
Static web reply.
The static web reply is send out as a whole at once and is immediately deleted after sending. Use it for regular-sized pages and content.
fawkes::StaticWebReply::StaticWebReply | ( | Code | code, |
std::string | body = "" |
||
) |
void fawkes::StaticWebReply::append_body | ( | const char * | format, |
... | |||
) |
Append to body.
format | format of the text to append. Supports the same format as printf(). |
Definition at line 253 of file reply.cpp.
References _body.
Referenced by MetricsRequestProcessor::process_request().
void fawkes::StaticWebReply::append_body | ( | const std::string & | s | ) |
|
virtual |
Get body.
Reimplemented in fawkes::WebPageReply.
Definition at line 289 of file reply.cpp.
References _body.
Referenced by StaticWebReply().
|
virtual |
Get length of body.
Reimplemented in fawkes::WebPageReply.
Definition at line 298 of file reply.cpp.
References _body.
StaticWebReply & fawkes::StaticWebReply::operator+= | ( | std::string | text | ) |
|
virtual |
Pack the data.
This method is called just before the reply is sent. You can implement this method if you need to compose your reply before body() and body_length() provide valid output.
Reimplemented in fawkes::WebPageReply.
|
protected |
Body of the reply.
Definition at line 151 of file reply.h.
Referenced by append_body(), body(), body_length(), operator+=(), fawkes::WebPageReply::pack(), StaticWebReply(), and fawkes::WebErrorPageReply::WebErrorPageReply().