The CppCMS framework consists of following parts:
|
|
## Long Living Classes
|
|
- Central `service` --- the major class that holds
|
the main application loop and manages all resources.
|
|
All global resources are accessed via this service.
|
|
It also hold the main event driven execution loop
|
based on `boost::asio::io_service`.
|
|
- `applications_pool` --- it the class that holds
|
a pool of user created applications and dispatches
|
them according to requested url. It is the major
|
connector between URL and application.
|
|
Each time the page is requested an application fetched
|
from it and then returned back for recycling.
|
|
- `thread_pool` --- is the thread pool for long running
|
and time consuming jobs that can't be executed withing
|
asynchronous event loop.
|
|
Generally, when new request arrives it is executed
|
by application in the `thread_pool`.
|
|
- `locale::pool` --- is the gateway to i18n and l10n
|
world. It holds the set of `std::locale` for each
|
supported locale required by developer. It also
|
adds custom facets like `gettext` in order to extend
|
localization capabilities behind the strict set of
|
facets provided by standard C++.
|
|
- The configuration of all CppCMS components is done
|
via single JSON object that is loaded by `service`
|
and accessible via `json::object const &settings()`
|
member function of `service` class.
|
|
## Connection Related Classes
|
|
When the main loop is started all incoming connections
|
are accepted and processed by `impl::cgi::connection` class.
|
|
This is an abstract class that various protocol connectors implement it. Currently CppCMS supports following protocols:
|
|
- HTTP --- very simple and limited implementation of HTTP
|
protocol that is used for debug purposes or for running
|
CppCMS behind http-proxy.
|
- FastCGI --- connector that implements standard FastCGI
|
web server API and allows running CppCMS application
|
behind any web server.
|
- SCGI --- connector that implements standard simple
|
and very useful SCGI protocol that is simpler equivalent
|
of complex FastCGI.
|
|
So, each time new connection is accepted it is read
|
completely, including parsing headers and all POST data.
|
|
When the connection becomes ready it is assigned
|
to user visible `http::context` object that provides
|
an interface for user to lower level CGI like protocol.
|
|
When the `http::context` is ready, appropriate `application`
|
is fetched from `applications_pool` and `http::context`
|
object is assigned to it.
|
|