libzeep

PrevUpHomeNext

Class controller

zeep::http::controller — A base class for controllers, classes that handle a request.

Synopsis

// In header: <zeep/http/controller.hpp>


class controller {
public:
  // construct/copy/destruct
  ();
  (controller &) = ;
  controller & (controller &) = ;
  ~();

  // public member functions
   
  (, request &, reply &);
   (request &, reply &) = ;
   () ;
   () ;
   (request &) ;
   (basic_server *);
  basic_server & () ;
  basic_server & ();
  json::element () ;
   () ;
   () ;
   () ;
};

Description

This concept is inspired by the Spring way of delegating the work to controller classes. In libzeep there are two major implementations of controllers: zeep::http::rest_controller and zeep::http::soap_controller

There can be multiple controllers in a web application, each is connected to a certain prefix-path. This is the leading part of the request URI.

controller public construct/copy/destruct

  1. ( prefix_path);
    constructor

    Parameters:

    prefix_path

    The prefix path this controller is bound to

  2. (controller &) = ;
  3. controller & (controller &) = ;
  4. ~();

controller public member functions

  1.  
    ( socket, request & req, 
                     reply & rep);
    Calls handle_request but stores a pointer to the request first.
  2.  (request & req, reply & rep) = ;
    The pure virtual method that actually handles the request.
  3.  () ;
    returns the defined prefix path
  4.  ( path) ;
    return whether this uri request path matches our prefix
  5.  (request & req) ;
    return the path with the prefix path stripped off
  6.  (basic_server * server);
    bind this controller to server
  7. basic_server & () ;
    return the server object we're bound to
  8. basic_server & ();
  9. json::element () ;
    get the credentials for the current request
  10.  () ;
    get the remote client address for the current request
  11.  ( role) ;
    returns whether the current user has role role
  12.  ( name) ;
    return a specific header line from the original request

PrevUpHomeNext