Re: [Cppcms-users] mapping across mount_points
Brought to you by:
artyom-beilis
|
From: Petr J. <ele...@ex...> - 2013-07-14 22:38:22
|
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.
|