Re: [Cppcms-users] non-greedy moint points
Brought to you by:
artyom-beilis
|
From: Marcel H. <ke...@co...> - 2013-07-15 09:19:15
|
On 15.07.2013 02:03, Petr Janda wrote:
> If you are dead-set on making WebAPI asynchronous, why not rewrite your
> mapping like this:
>
>
> booster::intrusive_ptr<WebAPI> bgworker(new WebAPI(srv));
>
> srv.applications_pool().mount(bgworker,
> cppcms::mount_point("/webapi(/(.*))", 1));
> srv.applications_pool().mount(cppcms::applications_factory<Dispatcher>());
This is how I do it, expect that you don't create a specific mount point
for the dispatcher. I tried it, no luck :/
> Specify your mapping for Dispatcher class in the constructor of
> Dispatcher as:
>
> mapper().root(settings().get<string>("myapp.root"));
>
> dispatcher().assign("^/somefunction$", &Dispatcher::index, this);
> mapper().assign("somefunction", "/somefunction")
>
> dispatcher().assign("^(.*)$", &Dispatcher::index, this); //catch all regexp
>
> mapper().assign("")
The only difference is, that you do mapper.assign(""), the rest is still
the same.
> What is your specific reason to run RPC server as an async app?
Async is "better" than sync, because it does not run in the main loop
and therefore can handle more connections.
http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime
http://permalink.gmane.org/gmane.comp.lib.cppcms.user/580
> attach(new WebAPI(srv), "webapi", "/webapi{1}", "^/webapi(/(.*))?$", 1);
> attach(new Index(srv), "index", "/index{1}", "^/(.*)?$", 1);
Here you mount WebAPI as sync app, that's not what I want. :/
|