WebPageReply Class Reference

Basic page reply. More...

#include <page_reply.h>

Inheritance diagram for WebPageReply:

List of all members.


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.

Static Public Member Functions

static std::string html_header (std::string &title)
 Generate HTML header.
static std::string html_footer ()
 Generate HTML footer.

Protected Member Functions

 WebPageReply (response_code_t code)
 Base constructor.

Protected Attributes

std::string _title
 Title of the page.

Friends

class WebRequestDispatcher
class WebviewThread

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 32 of file page_reply.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
title title of the page
body Optional initial body of the page

Definition at line 63 of file page_reply.cpp.

References _title.

WebPageReply::WebPageReply ( response_code_t  code  )  [protected]

Base constructor.

Constructor that does not set a title or anything. Use for sub-classes.

Parameters:
code HTTP code for this reply

Definition at line 74 of file page_reply.cpp.


Member Function Documentation

const std::string & WebPageReply::body (  )  [virtual]

Get body.

Returns:
reference to body.

Reimplemented from StaticWebReply.

Definition at line 94 of file page_reply.cpp.

std::string::size_type WebPageReply::body_length (  )  [virtual]

Get length of body.

Returns:
body length

Reimplemented from StaticWebReply.

Definition at line 87 of file page_reply.cpp.

std::string WebPageReply::html_footer (  )  [static]

Generate HTML footer.

Generate basic HTML footer and possibly additional footer content.

Returns:
generated footer

Definition at line 138 of file page_reply.cpp.

References WebviewServiceBrowseHandler::service_list(), and fawkes::StringConversions::to_string().

Referenced by pack().

std::string WebPageReply::html_header ( std::string &  title  )  [static]

Generate HTML header.

Generate basic HTML header for the body and generate the navigation in the page header.

Parameters:
title title of the page
Returns:
generated header

Definition at line 107 of file page_reply.cpp.

References fawkes::HostInfo::short_name().

Referenced by pack().

void WebPageReply::pack (  )  [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 StaticWebReply.

Definition at line 81 of file page_reply.cpp.

References StaticWebReply::_body, _title, html_footer(), and html_header().


Member Data Documentation

std::string WebPageReply::_title [protected]

Title of the page.

Definition at line 51 of file page_reply.h.

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


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