zeep::http::basic_webapp
// In header: </build/libzeep-xG2HQn/libzeep-3.0.5/zeep/http/webapp.hpp> class basic_webapp { public: // member classes/structs/unions struct mount_point { // public data members std::string path; std::string realm; handler_type handler; }; // construct/copy/destruct basic_webapp(const std::string & = "http://www.cmbi.ru.nl/libzeep/ml", const boost::filesystem::path & = "."); ~basic_webapp(); // public member functions virtual void set_docroot(const boost::filesystem::path &); boost::filesystem::path get_docroot() const; virtual void validate_authentication(request &, const std::string &); virtual std::string validate_authentication(const std::string &, const std::string &, const std::string &, const std::string &); virtual std::string get_hashed_password(const std::string &, const std::string &); virtual void create_unauth_reply(const request &, bool, const std::string &, const std::string &, reply &); virtual void create_error_reply(const request &, status_type, reply &); virtual void create_error_reply(const request &, status_type, const std::string &, reply &); virtual void handle_request(const request &, reply &); // protected member functions virtual void create_unauth_reply(const request &, bool, const std::string &, reply &); void mount(const std::string &, handler_type); void mount(const std::string &, const std::string &, handler_type); virtual void handle_file(const request &, const el::scope &, reply &); virtual void load_template(const std::string &, xml::document &); void load_template(const boost::filesystem::path &, xml::document &); virtual void get_cookies(const el::scope &, parameter_map &); virtual void create_reply_from_template(const std::string &, const el::scope &, reply &); virtual void process_xml(xml::node *, const el::scope &, boost::filesystem::path); virtual void add_processor(const std::string &, processor_type); virtual void process_include(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_if(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_iterate(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_for(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_number(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_options(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_option(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_checkbox(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_url(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_param(xml::element *, const el::scope &, boost::filesystem::path); virtual void process_embed(xml::element *, const el::scope &, boost::filesystem::path); virtual void init_scope(el::scope &); virtual void get_parameters(const el::scope &, parameter_map &); };
basic_webapp
public member functionsvirtual void set_docroot(const boost::filesystem::path & docroot);
boost::filesystem::path get_docroot() const;
virtual void validate_authentication(request & request, const std::string & realm);Support for HTTP Authentication, sets the username field in the request.
virtual std::string validate_authentication(const std::string & authorization, const std::string & method, const std::string & uri, const std::string & realm);Support for HTTP Authentication, returns the validated user name.
virtual std::string get_hashed_password(const std::string & username, const std::string & realm);
Subclasses should implement this to return the password for the user, result should be the MD5 hash of the string username + ':' + realm + ':' + password
virtual void create_unauth_reply(const request & req, bool stale, const std::string & realm, const std::string & authentication, reply & rep);Create an error reply for the error containing a validation header.
virtual void create_error_reply(const request & req, status_type status, reply & rep);Create an error reply for the error.
virtual void create_error_reply(const request & req, status_type status, const std::string & message, reply & rep);Create an error reply for the error with an additional message for the user.
virtual void handle_request(const request & req, reply & rep);Dispatch and handle the request.
basic_webapp
protected member functionsvirtual void create_unauth_reply(const request & req, 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 mount(const std::string & path, const std::string & realm, handler_type handler);version of mount that requires authentication
virtual void handle_file(const request & request, const el::scope & scope, reply & reply);Default handler for serving files out of our doc root.
virtual 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);
virtual void get_cookies(const el::scope & scope, parameter_map & cookies);Return a
parameter_map
containing the cookies as found in the current request. virtual void create_reply_from_template(const std::string & file, const el::scope & scope, reply & reply);create a reply based on a template
virtual 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
virtual void add_processor(const std::string & name, processor_type processor);To add additional processors.
virtual void process_include(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:include tags
virtual void process_if(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:if tags
virtual void process_iterate(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:iterate tags
virtual void process_for(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:for tags
virtual void process_number(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:number tags
virtual void process_options(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:options tags
virtual void process_option(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:option tags
virtual void process_checkbox(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:checkbox tags
virtual void process_url(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:url tags
virtual void process_param(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:param tags
virtual void process_embed(xml::element * node, const el::scope & scope, boost::filesystem::path dir);default handler for mrs:embed tags
virtual void init_scope(el::scope & scope);Initialize the
el::scope
object. virtual void get_parameters(const el::scope & scope, parameter_map & parameters);Return the original parameters as found in the current request.