![]() |
Table of Contents
The goal of libzeep is to provide a library that makes creating web applications as easy as possible. A lot of frameworks already exist to help building these interactive web apps written in languages ranging from Java to Python to more exotic stuff like Ruby and Laravel. The Spring version stands out between these since it is well designed and offers tons of features and still is fairly easy to work with. But all of these have one flaw in common, they're not written in C++ and thus lack the raw performance.
Libzeep tries to implement some of the design patterns found in Spring. There is a very basic HTTP server class with some additional classes that help in creating daemon processes when running a UNIX or lookalike. This HTTP server class delegates requests to controller classes that each process requests in their own corner of the URI space occupied by your server.
There are three main controller classes, each targeted at a different task.
The first, html_controller
maps requests to functions that take a request
and scope
and return a reply
.
Various routines are available to help constructing XHTML based replies based
on XHTML template files. These files can contain special tags that will be
processed and the values can be expressed in expression
language.
The second controller class is the rest_controller
. This one also
maps requests to functions, but this time the parameters in the request are
automatically translated into function parameters and the result of the function
is converted back into JSON automatically. Named parameters can be passed
in the payload of a POST request, as query parameters in a GET request or
as parts of the URI path, as in GET /book/1234/title
where
you request the title of book number 1234.
The third controller is the soap_controller
. Similar to
the REST controller, but this time the translation is between SOAP XML messages
and parameters and vice versa.