PrevUpHomeNext

Class webapp

zeep::http::webapp

Synopsis

// 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 &);
};

Description

webapp is a specialization of zeep::http::server, it is used to create interactive web applications.

webapp public construct/copy/destruct

  1. webapp(const std::string & ns = "http://www.cmbi.ru.nl/libzeep/ml", 
           const boost::filesystem::path & docroot = ".");

    first parameter to constructor is the namespace to use in template XHTML files.

  2. ~webapp();

webapp public member functions

  1. void set_docroot(const boost::filesystem::path & docroot);
  2. boost::filesystem::path get_docroot() const;

webapp protected member functions

  1. void handle_request(const request & req, reply & rep);
  2. void create_unauth_reply(bool stale, const std::string & realm, reply & rep);
  3. 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);

  4. void handle_file(const request & request, const el::scope & scope, 
                     reply & reply);
    Default handler for serving files out of our doc root.
  5. void load_template(const std::string & file, xml::document & doc);
    Use load_template to fetch the XHTML template file.
  6. void load_template(const boost::filesystem::path & file, xml::document & doc);
  7. void create_reply_from_template(const std::string & file, 
                                    const el::scope & scope, reply & reply);
    create a reply based on a template
  8. 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
  9. void add_processor(const std::string & name, processor_type processor);
    To add additional processors.
  10. void process_include(xml::element * node, const el::scope & scope, 
                         boost::filesystem::path dir);
    default handler for mrs:include tags
  11. void process_if(xml::element * node, const el::scope & scope, 
                    boost::filesystem::path dir);
    default handler for mrs:if tags
  12. void process_iterate(xml::element * node, const el::scope & scope, 
                         boost::filesystem::path dir);
    default handler for mrs:iterate tags
  13. void process_for(xml::element * node, const el::scope & scope, 
                     boost::filesystem::path dir);
    default handler for mrs:for tags
  14. void process_number(xml::element * node, const el::scope & scope, 
                        boost::filesystem::path dir);
    default handler for mrs:number tags
  15. void process_options(xml::element * node, const el::scope & scope, 
                         boost::filesystem::path dir);
    default handler for mrs:options tags
  16. void process_option(xml::element * node, const el::scope & scope, 
                        boost::filesystem::path dir);
    default handler for mrs:option tags
  17. void process_checkbox(xml::element * node, const el::scope & scope, 
                          boost::filesystem::path dir);
    default handler for mrs:checkbox tags
  18. void process_url(xml::element * node, const el::scope & scope, 
                     boost::filesystem::path dir);
    default handler for mrs:url tags
  19. void process_param(xml::element * node, const el::scope & scope, 
                       boost::filesystem::path dir);
    default handler for mrs:param tags
  20. void process_embed(xml::element * node, const el::scope & scope, 
                       boost::filesystem::path dir);
    default handler for mrs:embed tags
  21. void init_scope(el::scope & scope);
    Initialize the el::scope object.
  22. void get_cookies(const el::scope & scope, parameter_map & cookies);
    Return a parameter_map containing the cookies as found in the current request.
  23. void get_parameters(const el::scope & scope, parameter_map & parameters);
    Return the original parameters as found in the current request.

PrevUpHomeNext