Thread: [Cppcms-users] mapping across mount_points
Brought to you by:
artyom-beilis
|
From: Marcel H. <ke...@co...> - 2013-07-14 12:54:04
Attachments:
signature.asc
|
Hi *,
I get a invalid url everytime I try the following:
App1 in mount_point "/foo" with mapped url "index"
App2 in mount_point "/bar"
Now I'd like to call url("index") in App2, but it does not work.
Is there a workaround, fix, bug?
Regards
|
|
From: Artyom B. <art...@ya...> - 2013-07-14 14:01:38
|
The url/mapping works for a specific application hierarchy. And each application hierarchy is mounted to a specific mount point. So you can't access to the url mapper of different hierarchy. You can create app3 that would have app1 and app2 connected via /foo and /bar. So to make two applications to share the mapping they should be in one hierarchy. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Marcel Hellwig <ke...@co...> >To: cpp...@li... >Sent: Sunday, July 14, 2013 3:53 PM >Subject: [Cppcms-users] mapping across mount_points > > >Hi *, > >I get a invalid url everytime I try the following: > >App1 in mount_point "/foo" with mapped url "index" >App2 in mount_point "/bar" > >Now I'd like to call url("index") in App2, but it does not work. >Is there a workaround, fix, bug? > >Regards > >------------------------------------------------------------------------------ >See everything from the browser to the database with AppDynamics >Get end-to-end visibility with application monitoring from AppDynamics >Isolate bottlenecks and diagnose root cause in seconds. >Start your free trial of AppDynamics Pro today! >http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
|
From: Marcel H. <ke...@co...> - 2013-07-14 14:22:54
Attachments:
signature.asc
|
On 14.07.2013 16:01, Artyom Beilis wrote: > The url/mapping works for a specific application hierarchy. And each > application hierarchy is mounted to a specific mount point. > So you can't access to the url mapper of different hierarchy. Hmm, is there a way to specify application wide mappings? > > You can create app3 that would have app1 and app2 connected via /foo > and /bar. Not possible that easy. App1 is sync, and app2 is a rpc_server, tell me how ;) But I think that would end in a mess. > So to make two applications to share the mapping they should be in one > hierarchy. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |
|
From: Petr J. <ele...@ex...> - 2013-07-14 20:31:50
Attachments:
signature.asc
|
Why are you trying to call rpc server function via "url" helper? On 15/07/2013 12:22 AM, Marcel Hellwig wrote: > On 14.07.2013 16:01, Artyom Beilis wrote: >> The url/mapping works for a specific application hierarchy. And each >> application hierarchy is mounted to a specific mount point. >> So you can't access to the url mapper of different hierarchy. > Hmm, is there a way to specify application wide mappings? >> >> You can create app3 that would have app1 and app2 connected via /foo >> and /bar. > Not possible that easy. App1 is sync, and app2 is a rpc_server, tell me > how ;) But I think that would end in a mess. >> So to make two applications to share the mapping they should be in one >> hierarchy. >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > > > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > -- Please use PGP to encrypt your email to ensure our privacy is respected. |
|
From: Marcel H. <ke...@co...> - 2013-07-14 20:34:09
Attachments:
signature.asc
|
On 14.07.2013 22:31, Petr Janda wrote: > Why are you trying to call rpc server function via "url" helper? Because I have a template where I'd like to call some rpc methods. The current status is hard-coded links, but I don't like that. If I change any url, everything else has to be changed, that's sad :/ |
|
From: Petr J. <ele...@ex...> - 2013-07-14 21:53:22
Attachments:
signature.asc
|
And calling url("/bar/index") doesn't work? It should if Bar is a
sub-application.
The URL helper can take an absolute path, provided that you're mapping
is set up correctly.
For example:
MyMainApp/SubApp1/show
MyMainApp/SubApp2/update
In the template of SubApp1::show, you can call url("/SubApp2/update")
provided that your SubApps are mounted correctly and mapper is properly
set up in each sub application.
On 15/07/2013 6:33 AM, Marcel Hellwig wrote:
> On 14.07.2013 22:31, Petr Janda wrote:
>> Why are you trying to call rpc server function via "url" helper?
> Because I have a template where I'd like to call some rpc methods. The
> current status is hard-coded links, but I don't like that. If I change
> any url, everything else has to be changed, that's sad :/
>
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: Petr J. <ele...@ex...> - 2013-07-14 22:01:09
Attachments:
signature.asc
|
Suggest you use mapper(value), instead of mapper(key, value) for
index-style pages. Saves typing and is more clear, imo.
ie. call to url("") will create a link to the root(the so called "index"
page) of the current application.
Petr
On 15/07/2013 7:53 AM, Petr Janda wrote:
> And calling url("/bar/index") doesn't work? It should if Bar is a
> sub-application.
>
> The URL helper can take an absolute path, provided that you're mapping
> is set up correctly.
>
> For example:
>
> MyMainApp/SubApp1/show
> MyMainApp/SubApp2/update
>
> In the template of SubApp1::show, you can call url("/SubApp2/update")
> provided that your SubApps are mounted correctly and mapper is properly
> set up in each sub application.
>
>
> On 15/07/2013 6:33 AM, Marcel Hellwig wrote:
>> On 14.07.2013 22:31, Petr Janda wrote:
>>> Why are you trying to call rpc server function via "url" helper?
>> Because I have a template where I'd like to call some rpc methods. The
>> current status is hard-coded links, but I don't like that. If I change
>> any url, everything else has to be changed, that's sad :/
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> See everything from the browser to the database with AppDynamics
>> Get end-to-end visibility with application monitoring from AppDynamics
>> Isolate bottlenecks and diagnose root cause in seconds.
>> Start your free trial of AppDynamics Pro today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>>
>>
>>
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: Marcel H. <ke...@co...> - 2013-07-14 22:13:10
Attachments:
signature.asc
|
On 15.07.2013 00:00, Petr Janda wrote:
> Suggest you use mapper(value), instead of mapper(key, value) for
> index-style pages. Saves typing and is more clear, imo.
>
> ie. call to url("") will create a link to the root(the so called "index"
> page) of the current application.
>> And calling url("/bar/index") doesn't work? It should if Bar is a
>> sub-application.
Hmmm, nope. Everything throws an exception. I have another problem with
mount_points but this is not the current topic. I will provide my
current mapping here:
main.cpp
> app.mount(...<dispatcher>...);
dispatcher.cpp
> attach(new Index(srv),
> "index", "/index{1}",
> "/index(/(.*))?", 1);
>
> mapper().root(settings().get<std::string>("app.root"));
index.cpp
> dispatcher().assign(".*", &Index::index, this);
> mapper().assign("index", "/index");
Tell me whats wrong. I'm not an expert in mapping, in fact I'm very
miserable.
|
|
From: Petr J. <ele...@ex...> - 2013-07-14 22:38:22
Attachments:
signature.asc
|
I'd advise to call the application something else than Index because
it's not a good class name, and you're likely going to confuse everyone.
You need to setup your application hierarchy structure correctly. I
strongly recommend reading some of the cppcms examples (blog, forum).
Your main.cpp should be calling your Application like this:
app.applications_pool().mount(applications_factory<apps::MyMainApp>());
app.run();
MyMainApp::MyMainApp constructor should contain something like this
attach(new Foo(srv), "foo", "/foo{1}", "^/foo(/(.*))?$", 1);
attach(new Bar(srv), "bar", "/bar{1}", "^/bar(/(.*))?$", 1);
On 15/07/2013 8:12 AM, Marcel Hellwig wrote:
> On 15.07.2013 00:00, Petr Janda wrote:
>> Suggest you use mapper(value), instead of mapper(key, value) for
>> index-style pages. Saves typing and is more clear, imo.
>>
>> ie. call to url("") will create a link to the root(the so called "index"
>> page) of the current application.
>>> And calling url("/bar/index") doesn't work? It should if Bar is a
>>> sub-application.
>
> Hmmm, nope. Everything throws an exception. I have another problem with
> mount_points but this is not the current topic. I will provide my
> current mapping here:
>
> main.cpp
>> app.mount(...<dispatcher>...);
> dispatcher.cpp
>> attach(new Index(srv),
>> "index", "/index{1}",
>> "/index(/(.*))?", 1);
>>
>> mapper().root(settings().get<std::string>("app.root"));
> index.cpp
>> dispatcher().assign(".*", &Index::index, this);
>> mapper().assign("index", "/index");
> Tell me whats wrong. I'm not an expert in mapping, in fact I'm very
> miserable.
>
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
--
Please use PGP to encrypt your email to ensure our privacy is respected.
|
|
From: Artyom B. <art...@ya...> - 2013-07-15 10:26:52
|
>________________________________
> From: Marcel Hellwig <ke...@co...>
>To: cpp...@li...
>Sent: Sunday, July 14, 2013 5:22 PM
>Subject: Re: [Cppcms-users] mapping across mount_points
>
>
>
>On 14.07.2013 16:01, Artyom Beilis wrote:
>
>The url/mapping works for a specific application hierarchy. And each application hierarchy is mounted to a specific mount point.
>>So you can't access to the url mapper of different hierarchy.
>>
Hmm, is there a way to specify application wide mappings?
>
Unfortunately not.
Technically asynchronous applications can be unmounted during their life time so mapping can be invalid.
or new applications can be mounted.
What you can do it to do something like that.
class dummy_async_mapping : public cppcms::application {
dummy_async_mapping(...)
{
// all mapping (not dispatching) goes there
}
}
class async_app : public dummy_async_mapping ...
class sync_app : public cppcms::application {
sync_app(...)
{
attach("/webapi/" , new dummy_async_mapping()
...
}
}
Such that they both would get the mapping you need.
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
|
|
From: Marcel H. <ke...@co...> - 2013-07-15 10:36:33
Attachments:
signature.asc
|
On 15.07.2013 12:26, Artyom Beilis wrote:
> Unfortunately not.
>
> Technically asynchronous applications can be unmounted during their life time so mapping can be invalid.
> or new applications can be mounted.
I know, a very usefull technique btw..
> What you can do it to do something like that.
>
> class dummy_async_mapping : public cppcms::application {
> dummy_async_mapping(...)
> {
> // all mapping (not dispatching) goes there
> }
> }
>
> class async_app : public dummy_async_mapping ...
>
> class sync_app : public cppcms::application {
> sync_app(...)
> {
> attach("/webapi/" , new dummy_async_mapping()
> ...
> }
> }
>
> Such that they both would get the mapping you need.
So, this will work? When I attach an async app in a sync context? The
last time I tried it like Petr suggested, it was mounted as sync.
>
>
> Artyom Beilis
> --------------
> CppCMS - C++ Web Framework: http://cppcms.com/
> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
|
|
From: Artyom B. <art...@ya...> - 2013-07-15 11:09:17
|
I mean attach only small class that does mapping only (no dispatching). There is attach function that does only mapping for example. http://cppcms.com/cppcms_ref/1.0.0/classcppcms_1_1application.html#ab31985c608cfb176bbbf0958f438fbf7 So also it would be "mounted synchronously" it is just some base class for sharing the mapping, not actual dispatching. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: Marcel Hellwig <ke...@co...> > To: cpp...@li... > Cc: > Sent: Monday, July 15, 2013 1:36 PM > Subject: Re: [Cppcms-users] mapping across mount_points > > On 15.07.2013 12:26, Artyom Beilis wrote: >> Unfortunately not. >> >> Technically asynchronous applications can be unmounted during their life > time so mapping can be invalid. >> or new applications can be mounted. > I know, a very usefull technique btw.. >> What you can do it to do something like that. >> >> class dummy_async_mapping : public cppcms::application { >> dummy_async_mapping(...) >> { >> // all mapping (not dispatching) goes there >> } >> } >> >> class async_app : public dummy_async_mapping ... >> >> class sync_app : public cppcms::application { >> sync_app(...) >> { >> attach("/webapi/" , new dummy_async_mapping() >> ... >> } >> } >> >> Such that they both would get the mapping you need. > So, this will work? When I attach an async app in a sync context? The > last time I tried it like Petr suggested, it was mounted as sync. >> >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |