Re: [Cppcms-users] Fwd: cppcms::rpc::json_rpc_server usage.
Brought to you by:
artyom-beilis
From: le ba <hma...@gm...> - 2012-05-22 07:39:17
|
Hi Artyom, this is the main overriden that I used: class numbers : public cppcms::rpc::json_rpc_server { public: numbers(cppcms::service &srv) : cppcms::rpc::json_rpc_server (srv) { dispatcher().assign("",&numbers::all,this); mapper().assign(""); } void main(std:string url) { if(!dispatcher().dispatch(url)) { response().make_error_response(http::response::not_found); } cppcms::rpc::json_rpc_server::main(url); } }; 2012/5/21 Artyom Beilis <art...@ya...> > > > > > > >I would like explain my questions. For example I create my dynamic page > > > (like template or templates_inheritance in the example) with ajax using > json_rpc inside: > > 1. Will I do a derivation from cppcms::appliaction and make a json > call inside or > > 2. Will I do a derivation from cppcms::rpc::json_rpc_server for all > application and children. > > See json_rcp_server is derived from cppcms::application, so everything you > have in application > you have in the RPC server. > > So if you use mostly AJAX and JSON-RPC API it makes sence to use > json_rpc_server for your code > > > >I'd like to know if the context is shared by url dispather and > json_rpc_call or they have two different context? > > > > No, but dispatching member functions would not work AFAIR as it dispatches > function calls in main() that > is overriden > > > If you want more specific answers be more specific > > > Artyom > > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |