Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::WebPageReply Class Reference

Basic page reply. More...

#include <>>

Inheritance diagram for fawkes::WebPageReply:

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.
- Public Member Functions inherited from fawkes::StaticWebReply
 StaticWebReply (response_code_t code, std::string body="")
 Constructor.
void append_body (const char *format,...)
 Append to body.
StaticWebReplyoperator+= (std::string text)
 Append simple text line.
- Public Member Functions inherited from fawkes::WebReply
 WebReply (response_code_t code)
 Constructor.
virtual ~WebReply ()
 Destructor.
response_code_t code () const
 Get response code.
void add_header (std::string header, std::string content)
 Add a HTTP header.
void add_header (std::string header_string)
 Add a HTTP header.
const HeaderMapheaders () const
 get headers.

Protected Member Functions

 WebPageReply (response_code_t code)
 Base constructor.

Protected Attributes

std::string _title
 Title of the page.
- Protected Attributes inherited from fawkes::StaticWebReply
std::string _body
 Body of the reply.

Additional Inherited Members

- Public Types inherited from fawkes::WebReply
enum  response_code_t {
  HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_PROCESSING = 102, HTTP_OK = 200,
  HTTP_CREATED = 201, HTTP_ACCEPTED = 202, HTTP_NON_AUTHORITATIVE_INFORMATION = 203, HTTP_NO_CONTENT = 204,
  HTTP_RESET_CONTENT = 205, HTTP_PARTIAL_CONTENT = 206, HTTP_MULTI_STATUS = 207, HTTP_MULTIPLE_CHOICES = 300,
  HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304,
  HTTP_USE_PROXY = 305, HTTP_SWITCH_PROXY = 306, HTTP_TEMPORARY_REDIRECT = 307, HTTP_BAD_REQUEST = 400,
  HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404,
  HTTP_METHOD_NOT_ALLOWED = 405, HTTP_METHOD_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_REQUEST_TIMEOUT = 408,
  HTTP_CONFLICT = 409, HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412,
  HTTP_REQUEST_ENTITY_TOO_LARGE = 413, HTTP_REQUEST_URI_TOO_LONG = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
  HTTP_EXPECTATION_FAILED = 417, HTTP_UNPROCESSABLE_ENTITY = 422, HTTP_LOCKED = 423, HTTP_FAILED_DEPENDENCY = 424,
  HTTP_UNORDERED_COLLECTION = 425, HTTP_UPGRADE_REQUIRED = 426, HTTP_RETRY_WITH = 449, HTTP_INTERNAL_SERVER_ERROR = 500,
  HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504,
  HTTP_HTTP_VERSION_NOT_SUPPORTED = 505, HTTP_VARIANT_ALSO_NEGOTIATES = 506, HTTP_INSUFFICIENT_STORAGE = 507, HTTP_BANDWIDTH_LIMIT_EXCEEDED = 509,
  HTTP_NOT_EXTENDED = 510
}
 HTTP response code. More...
typedef std::map< std::string,
std::string > 
HeaderMap
 Map of headers.

Detailed Description

Basic page reply.

This reply adds header and footer as appropriate to form a HTML document with logo and navigation.

Author
Tim Niemueller

Definition at line 36 of file page_reply.h.

Constructor & Destructor Documentation

fawkes::WebPageReply::WebPageReply ( std::string  title,
std::string  body = "" 
)

Constructor.

Parameters
titletitle of the page
bodyOptional 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.

Parameters
codeHTTP code for this reply

Definition at line 73 of file page_reply.cpp.

Member Function Documentation

const std::string & fawkes::WebPageReply::body ( )
virtual

Get body.

Returns
reference to 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.

Returns
body length

Reimplemented from fawkes::StaticWebReply.

Definition at line 122 of file page_reply.cpp.

virtual void fawkes::WebPageReply::pack ( )
inlinevirtual

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.

Parameters
active_baseurlthe active navigation URL, can be used for instance to high-light the current section in the navigation.
headergenheader generator
footergenfooter generator

Definition at line 100 of file page_reply.cpp.

References fawkes::StaticWebReply::_body, _title, fawkes::WebPageFooterGenerator::html_footer(), fawkes::WebPageHeaderGenerator::html_header(), and fawkes::HostInfo::short_name().

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.

Parameters
hheader to set

Definition at line 85 of file page_reply.cpp.

Referenced by RRDWebRequestProcessor::process_request(), WebviewBlackBoardRequestProcessor::process_request(), and ROSWebviewRequestProcessor::process_request().

Member Data Documentation

std::string fawkes::WebPageReply::_title
protected

Title of the page.

Definition at line 55 of file page_reply.h.

Referenced by pack(), fawkes::WebErrorPageReply::WebErrorPageReply(), and WebPageReply().


The documentation for this class was generated from the following files: