## Roles |
|
`worker_thread` and `application` are very similar classes that gives user similar APIs but they have important differences: |
|
`worker_thread` has single instance in each worker thread or process, it is usually not used directly, but it is referenced by several `application` classes. |
|
In many cases, we need to have more then one application or sub application in our process (for example wiki and forum or users panel and administration panel). |
|
All these application share same controls like access to cache and sessions, access for HTTP requests --- all these stored in `worker_thread` class. |
|
In terms of API, both classes are very similar with the difference that `worker_thread` stores actual data and `application` stores references to this data in `worker_thread`. |
|
In most of cases developers should derive their own classes |
from `cppcms::application` and not from `cppcms::worker_thread`. |
|
## Constructors |
|
worker_thread(manager const &s); |
application(worker_thread &w); |
|
`worker_thread` and `application` constructors should receive a reference to `manager` and primary `worker_thread`. |
|
For example: |
|
class my_application : public application { |
my_application(worker_thread &w) : application(w) { |
... |
|
|
## Public Members |
|
### cppcms::application |
|
worker_thread &worker; |
url_parser &url; |
manager const &app; |
cgicc::Cgicc *&cgi; |
cgicc::CgiEnvironment const *&env; |
cgicc_connection *&cgi_conn; |
cache_iface &cache; |
session_interface &session; |
ostream &cout; |
boost::signal<void()> &on_start; |
boost::signal<void()> &on_end; |
|
### cppcms::worker\_thread |
|
url_parser url; |
manager const &app; |
cgicc::Cgicc *cgi; |
cgicc::CgiEnvironment const *env; |
cgicc_connection *cgi_conn; |
cache_iface cache; |
session_interface session; |
ostream cout; |
boost::signal<void()> on_start; |
boost::signal<void()> on_end; |
|
### Description |
|
- `url_parser url` or `url_parser &url` |
|
It is a class responsible on binding various handlers |
to different requested url. See [`cppcms::url_parser`](/wikipp/en/page/ref_cppcms_url_parser). |