Thread: [Cppcms-users] How to get attached applications?
Brought to you by:
artyom-beilis
From: sergey l. <ccp...@gm...> - 2012-10-20 08:25:42
|
Dear All! How can I get attached application (attached_app) from main application (main_app)? I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. For example my application consist of: int main() { ... service.applications_pool().mount(cppcms::applications_factory<main_app>()); ... } bool attached_app::check() { return true; } main_app::main_app(cppcms::service &service) : cppcms::application(service) { ... attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); ... } main_app::main(std::string url) { /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ } Thanks in advance! |
From: Artyom B. <art...@ya...> - 2012-10-20 09:01:28
|
Obviously... keep a pointer on it? this->my_attached_app = new attached_app(service); attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: sergey lavrov <ccp...@gm...> >To: cpp...@li... >Sent: Saturday, October 20, 2012 10:25 AM >Subject: [Cppcms-users] How to get attached applications? > > >Dear All! > > >How can I get attached application (attached_app) from main application (main_app)? >I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. > > >For example my application consist of: > > >int main() { > ... > service.applications_pool().mount(cppcms::applications_factory<main_app>()); > ... >} > > >bool attached_app::check() { > return true; >} > > >main_app::main_app(cppcms::service &service) : cppcms::application(service) { > ... > attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); > ... >} > > >main_app::main(std::string url) { > /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ >} > > >Thanks in advance! > > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: sergey l. <ccp...@gm...> - 2012-10-20 09:15:40
|
Dear Artyom, thanks for quick reply! Yes your approach is obviously but is it some method in cppcms to get pointer of attached application (attached_app) and not creating member in main application class and storing pointer in it? Thanks in advance! On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote: > Obviously... keep a pointer on it? > > this->my_attached_app = new attached_app(service); > attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* sergey lavrov <ccp...@gm...> > *To:* cpp...@li... > *Sent:* Saturday, October 20, 2012 10:25 AM > *Subject:* [Cppcms-users] How to get attached applications? > > Dear All! > > How can I get attached application (attached_app) from main application > (main_app)? > I need to call some functions (for example attached_app::check()) > from attached application (attached_app) in main application > (main_app) before redirect to another page or process further. > > For example my application consist of: > > int main() { > ... > > service.applications_pool().mount(cppcms::applications_factory<main_app>()); > ... > } > > bool attached_app::check() { > return true; > } > > main_app::main_app(cppcms::service &service) : > cppcms::application(service) { > ... > attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); > ... > } > > main_app::main(std::string url) { > /* There I need to call attached_app::check() first to check user > session variables and url before redirect to another page or > process further. */ > } > > Thanks in advance! > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Artyom B. <art...@ya...> - 2012-10-20 11:45:19
|
No, such an api is not provided, you can only get a pointer to parent application. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: sergey lavrov <ccp...@gm...> >To: cpp...@li... >Sent: Saturday, October 20, 2012 11:15 AM >Subject: Re: [Cppcms-users] How to get attached applications? > > >Dear Artyom, thanks for quick reply! > > >Yes your approach is obviously but is it some method in cppcms to get pointer of attached application (attached_app) and not creating member in main application class and storing pointer in it? > > >Thanks in advance! > > > >On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote: > >Obviously... keep a pointer on it? >> >> >>this->my_attached_app = new attached_app(service); >>attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: sergey lavrov <ccp...@gm...> >>>To: cpp...@li... >>>Sent: Saturday, October 20, 2012 10:25 AM >>>Subject: [Cppcms-users] How to get attached applications? >>> >>> >>> >>>Dear All! >>> >>> >>>How can I get attached application (attached_app) from main application (main_app)? >>>I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. >>> >>> >>>For example my application consist of: >>> >>> >>>int main() { >>> ... >>> service.applications_pool().mount(cppcms::applications_factory<main_app>()); >>> ... >>>} >>> >>> >>>bool attached_app::check() { >>> return true; >>>} >>> >>> >>>main_app::main_app(cppcms::service &service) : cppcms::application(service) { >>> ... >>> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); >>> ... >>>} >>> >>> >>>main_app::main(std::string url) { >>> /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ >>>} >>> >>> >>>Thanks in advance! >>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Everyone hates slow websites. So do we. >>Make your web apps faster with AppDynamics >>Download AppDynamics Lite for free today: >>http://p.sf.net/sfu/appdyn_sfd2d_oct >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |
From: sergey l. <ccp...@gm...> - 2012-10-20 12:29:19
|
Can I create a feature request or do you think such functionality are unnecessary? On Sat, Oct 20, 2012 at 3:45 PM, Artyom Beilis <art...@ya...> wrote: > No, such an api is not provided, you can only get a pointer to parent > application. > > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* sergey lavrov <ccp...@gm...> > *To:* cpp...@li... > *Sent:* Saturday, October 20, 2012 11:15 AM > *Subject:* Re: [Cppcms-users] How to get attached applications? > > Dear Artyom, thanks for quick reply! > > Yes your approach is obviously but is it some method in cppcms to get > pointer of attached application (attached_app) and not creating member in > main application class and storing pointer in it? > > Thanks in advance! > > > On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...>wrote: > > Obviously... keep a pointer on it? > > this->my_attached_app = new attached_app(service); > attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* sergey lavrov <ccp...@gm...> > *To:* cpp...@li... > *Sent:* Saturday, October 20, 2012 10:25 AM > *Subject:* [Cppcms-users] How to get attached applications? > > Dear All! > > How can I get attached application (attached_app) from main application > (main_app)? > I need to call some functions (for example attached_app::check()) > from attached application (attached_app) in main application > (main_app) before redirect to another page or process further. > > For example my application consist of: > > int main() { > ... > > service.applications_pool().mount(cppcms::applications_factory<main_app>()); > ... > } > > bool attached_app::check() { > return true; > } > > main_app::main_app(cppcms::service &service) : > cppcms::application(service) { > ... > attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); > ... > } > > main_app::main(std::string url) { > /* There I need to call attached_app::check() first to check user > session variables and url before redirect to another page or > process further. */ > } > > Thanks in advance! > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_sfd2d_oct > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: Artyom B. <art...@ya...> - 2012-10-20 15:14:49
|
>________________________________ > From: sergey lavrov <ccp...@gm...> >To: cpp...@li... >Sent: Saturday, October 20, 2012 2:29 PM >Subject: Re: [Cppcms-users] How to get attached applications? > > >Can I create a feature request or do you think such functionality are unnecessary? > You can create a feature request, even though I don't think it is critical. The best? Implement such a feature and send a patch. Hints: create an sub-application iterator (using iterator facade in booster headers) Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > >On Sat, Oct 20, 2012 at 3:45 PM, Artyom Beilis <art...@ya...> wrote: > >No, such an api is not provided, you can only get a pointer to parent application. >> >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: sergey lavrov <ccp...@gm...> >>>To: cpp...@li... >>>Sent: Saturday, October 20, 2012 11:15 AM >>>Subject: Re: [Cppcms-users] How to get attached applications? >>> >>> >>> >>>Dear Artyom, thanks for quick reply! >>> >>> >>>Yes your approach is obviously but is it some method in cppcms to get pointer of attached application (attached_app) and not creating member in main application class and storing pointer in it? >>> >>> >>>Thanks in advance! >>> >>> >>> >>>On Sat, Oct 20, 2012 at 1:01 PM, Artyom Beilis <art...@ya...> wrote: >>> >>>Obviously... keep a pointer on it? >>>> >>>> >>>>this->my_attached_app = new attached_app(service); >>>>attach(this->my_attached_app, "index", "{1}", "^(.*)$", 1); >>>> >>>> >>>>Artyom Beilis >>>>-------------- >>>>CppCMS - C++ Web Framework: http://cppcms.com/ >>>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>>> >>>> >>>> >>>>>________________________________ >>>>> From: sergey lavrov <ccp...@gm...> >>>>>To: cpp...@li... >>>>>Sent: Saturday, October 20, 2012 10:25 AM >>>>>Subject: [Cppcms-users] How to get attached applications? >>>>> >>>>> >>>>> >>>>>Dear All! >>>>> >>>>> >>>>>How can I get attached application (attached_app) from main application (main_app)? >>>>>I need to call some functions (for example attached_app::check()) from attached application (attached_app) in main application (main_app) before redirect to another page or process further. >>>>> >>>>> >>>>>For example my application consist of: >>>>> >>>>> >>>>>int main() { >>>>> ... >>>>> service.applications_pool().mount(cppcms::applications_factory<main_app>()); >>>>> ... >>>>>} >>>>> >>>>> >>>>>bool attached_app::check() { >>>>> return true; >>>>>} >>>>> >>>>> >>>>>main_app::main_app(cppcms::service &service) : cppcms::application(service) { >>>>> ... >>>>> attach(new attached_app(service), "index", "{1}", "^(.*)$", 1); >>>>> ... >>>>>} >>>>> >>>>> >>>>>main_app::main(std::string url) { >>>>> /* There I need to call attached_app::check() first to check user session variables and url before redirect to another page or process further. */ >>>>>} >>>>> >>>>> >>>>>Thanks in advance! >>>>> >>>>> >>>>>------------------------------------------------------------------------------ >>>>>Everyone hates slow websites. So do we. >>>>>Make your web apps faster with AppDynamics >>>>>Download AppDynamics Lite for free today: >>>>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>>>_______________________________________________ >>>>>Cppcms-users mailing list >>>>>Cpp...@li... >>>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>>> >>>>> >>>>> >>>>------------------------------------------------------------------------------ >>>>Everyone hates slow websites. So do we. >>>>Make your web apps faster with AppDynamics >>>>Download AppDynamics Lite for free today: >>>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>>_______________________________________________ >>>>Cppcms-users mailing list >>>>Cpp...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>> >>>------------------------------------------------------------------------------ >>>Everyone hates slow websites. So do we. >>>Make your web apps faster with AppDynamics >>>Download AppDynamics Lite for free today: >>>http://p.sf.net/sfu/appdyn_sfd2d_oct >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >>------------------------------------------------------------------------------ >>Everyone hates slow websites. So do we. >>Make your web apps faster with AppDynamics >>Download AppDynamics Lite for free today: >>http://p.sf.net/sfu/appdyn_sfd2d_oct >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_sfd2d_oct >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |