Fawkes API
Fawkes Development Version
|
Basic page reply. More...
#include <>>
Public Member Functions | |
WebPageReply (std::string title, std::string page="") | |
Constructor. | |
virtual const std::string & | body () |
Get body. | |
virtual std::string::size_type | body_length () |
Get length of body. | |
virtual void | pack () |
Pack the data. | |
virtual void | pack (std::string active_baseurl, WebPageHeaderGenerator *headergen, WebPageFooterGenerator *footergen) |
Pack web page reply. | |
virtual void | set_html_header (std::string h) |
Set HTML header text. | |
Protected Member Functions | |
WebPageReply (response_code_t code) | |
Base constructor. | |
Protected Attributes | |
std::string | _title |
Title of the page. |
Basic page reply.
This reply adds header and footer as appropriate to form a HTML document with logo and navigation.
fawkes::WebPageReply::WebPageReply | ( | std::string | title, |
std::string | body = "" |
||
) |
Constructor.
title | title of the page |
body | Optional initial body of the page |
Definition at line 62 of file page_reply.cpp.
References _title.
fawkes::WebPageReply::WebPageReply | ( | response_code_t | code | ) | [protected] |
Base constructor.
Constructor that does not set a title or anything. Use for sub-classes.
code | HTTP code for this reply |
Definition at line 73 of file page_reply.cpp.
const std::string & fawkes::WebPageReply::body | ( | ) | [virtual] |
Get body.
Reimplemented from fawkes::StaticWebReply.
Definition at line 129 of file page_reply.cpp.
std::string::size_type fawkes::WebPageReply::body_length | ( | ) | [virtual] |
Get length of body.
Reimplemented from fawkes::StaticWebReply.
Definition at line 122 of file page_reply.cpp.
virtual void fawkes::WebPageReply::pack | ( | ) | [inline, 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 from fawkes::StaticWebReply.
Definition at line 43 of file page_reply.h.
References pack().
Referenced by pack().
void fawkes::WebPageReply::pack | ( | std::string | active_baseurl, |
WebPageHeaderGenerator * | headergen, | ||
WebPageFooterGenerator * | footergen | ||
) | [virtual] |
Pack web page reply.
This method creates the final page by calling the header and footer generators if supplied (otherwise a standard header is chosen) and the body.
active_baseurl | the active navigation URL, can be used for instance to high-light the current section in the navigation. |
headergen | header generator |
footergen | footer generator |
Definition at line 100 of file page_reply.cpp.
References fawkes::WebPageHeaderGenerator::html_header(), _title, fawkes::HostInfo::short_name(), fawkes::StaticWebReply::_body, and fawkes::WebPageFooterGenerator::html_footer().
void fawkes::WebPageReply::set_html_header | ( | std::string | h | ) | [virtual] |
Set HTML header text.
The given text is placed in the head section of the HTML page. You can use it for example to add custom stylesheets or JavaScript.
h | header to set |
Definition at line 85 of file page_reply.cpp.
Referenced by ROSWebviewRequestProcessor::process_request(), RRDWebRequestProcessor::process_request(), and WebviewBlackBoardRequestProcessor::process_request().
std::string fawkes::WebPageReply::_title [protected] |
Title of the page.
Definition at line 55 of file page_reply.h.
Referenced by fawkes::WebErrorPageReply::WebErrorPageReply(), WebPageReply(), and pack().