Re: [Cppcms-users] Page handlers from configuration
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-04-27 07:51:16
|
In general there is no built in loadable module support of the applications, it is planned for next release: http://cppcms.com/wikipp/en/page/cppcms_1x_tasks#Provide.Plugin.Framework But many users had already implement such kind of support, there is class that allows to load modules easily http://cppcms.com/cppcms_ref/latest/classbooster_1_1shared__object.html And cppcms templates are fully pluggable, i.e. they are self registered so only thing you need to do is to link the templates to shared object that you are loading. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Saikumar Gandapodi <sai...@gm...> >To: cpp...@li... >Sent: Wednesday, April 24, 2013 4:54 PM >Subject: [Cppcms-users] Page handlers from configuration > > >Before I reinvent the wheel, I wanted to check with you first to see if there >is an easier method to accomplish this. > >Goal: I want to specify the dispatch handler method through means of a class >whose instance is created through a class factory using a service name. >Why: So that we can specify the page handlers through the configuration file and >not touch the main module for adding/updating/deleting a page. > >You can notice that the service module is created using a class factory and used >for the assign method in dispatcher. >I know the below code is wrong and will not work, but wanted to show you the >concept what I would like to accomplish. >Any ideas ? > >void CPPCMSServer::initmapping( cppcms::service &srv ) { > string page = "/login"; // Read from the configuration > // Creates an instance of LoginServiceModule > ServiceModule *sm = CreateServiceModuleFactory(page); > dispatcher().assign(page, &ServiceModule::processRequest, sm); >} > >class ServiceModule >{ >public: > virtual void processRequest(cppcms::application &app) = 0; >}; > >class LoginServiceModule : public ServiceModule { >public: > LoginServiceModule() {} > void processRequest(cppcms::application &app); >}; > >void LoginServiceModule::processRequest(cppcms::application &app) { > // Process page request for "/main/login" page. >} > > > >------------------------------------------------------------------------------ >Try New Relic Now & We'll Send You this Cool Shirt >New Relic is the only SaaS-based application performance monitoring service >that delivers powerful full stack analytics. Optimize and monitor your >browser, app, & servers with just a few lines of code. Try New Relic >and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |