zeep::http::webapp
// In header: </home/maarten/projects/libzeep/zeep/http/webapp.hpp> class webapp : public zeep::http::server { public: // construct/copy/destruct webapp(const std::string & = "http://www.cmbi.ru.nl/libzeep/ml", const boost::filesystem::path & = "."); ~webapp(); // public member functions void set_docroot(const boost::filesystem::path &); boost::filesystem::path get_docroot() const; // protected member functions void handle_request(const request &, reply &); void create_unauth_reply(bool, const std::string &, reply &); void mount(const std::string &, handler_type); void handle_file(const request &, const el::scope &, reply &); void load_template(const std::string &, xml::document &); void load_template(const boost::filesystem::path &, xml::document &); void create_reply_from_template(const std::string &, const el::scope &, reply &); void process_xml(xml::node *, const el::scope &, boost::filesystem::path); void add_processor(const std::string &, processor_type); void process_include(xml::element *, const el::scope &, boost::filesystem::path); void process_if(xml::element *, const el::scope &, boost::filesystem::path); void process_iterate(xml::element *, const el::scope &, boost::filesystem::path); void process_for(xml::element *, const el::scope &, boost::filesystem::path); void process_number(xml::element *, const el::scope &, boost::filesystem::path); void process_options(xml::element *, const el::scope &, boost::filesystem::path); void process_option(xml::element *, const el::scope &, boost::filesystem::path); void process_checkbox(xml::element *, const el::scope &, boost::filesystem::path); void process_url(xml::element *, const el::scope &, boost::filesystem::path); void process_param(xml::element *, const el::scope &, boost::filesystem::path); void process_embed(xml::element *, const el::scope &, boost::filesystem::path); void init_scope(el::scope &); void get_cookies(const el::scope &, parameter_map &); void get_parameters(const el::scope &, parameter_map &); };
webapp is a specialization of zeep::http::server, it is used to create interactive web applications.
webapp
protected member functionsvoid handle_request(const request & req, reply & rep);
void create_unauth_reply(bool stale, const std::string & realm, reply & rep);
void mount(const std::string & path, handler_type handler);
assign a handler function to a path in the server's namespace Usually called like this:
mount("page", boost::bind(&page_handler, this, _1, _2, _3));
Where page_handler is defined as:
void my_server::page_handler(const request& request, const el::scope& scope, reply& reply);
void handle_file(const request & request, const el::scope & scope, reply & reply);Default handler for serving files out of our doc root.
void load_template(const std::string & file, xml::document & doc);Use load_template to fetch the XHTML template file.
void load_template(const boost::filesystem::path & file, xml::document & doc);
void create_reply_from_template(const std::string & file, const el::scope & scope, reply & reply);create a reply based on a template
void process_xml(xml::node * node, const el::scope & scope, boost::filesystem::path dir);process xml parses the XHTML and fills in the special tags and evaluates the el constructs
void add_processor(const std::string & name, processor_type processor);To add additional processors.
void process_include(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:include tags
void process_if(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:if tags
void process_iterate(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:iterate tags
void process_for(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:for tags
void process_number(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:number tags
void process_options(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:options tags
void process_option(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:option tags
void process_checkbox(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:checkbox tags
void process_url(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:url tags
void process_param(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:param tags
void process_embed(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:embed tags
void init_scope(el::scope & scope);Initialize the
el::scope
object. void get_cookies(const el::scope & scope, parameter_map & cookies);Return a
parameter_map
containing the cookies as found in the current request. void get_parameters(const el::scope & scope, parameter_map & parameters);Return the original parameters as found in the current request.