Re: [Cppcms-users] Issues with resubmitting context in v1.2
Brought to you by:
artyom-beilis
From: Artyom B. <art...@gm...> - 2016-06-19 05:57:10
|
1st of all sorry for delayed reply - was offline for a while. Regarding your error - you had probably missed the concept of filter. Filter works BEFORE the data was uploaded processed. So you can do some stuff on the fly instead of downloading big content and discoverting an issue. You need to check if request().is_ready() and only than you can use it/forward it. Also JSON-RPC class does not support filer handling it is also not really needed. Artyom On Wed, Jun 8, 2016 at 1:08 PM, CN <cn...@fa...> wrote: > Hi! > > Take "Resubmitting Context" in > http://cppcms.com/wikipp/en/page/cppcms_1_2_filtering > as an example. I encounter two issues as shown in the comments in "class > part2". > > int main(int argc,char ** argv) > { > cppcms::service sv(argc,argv); > booster::shared_ptr<cppcms::application_specific_pool> > post_processor=cppcms::create_pool<part2>(); > sv.applications_pool().mount(post_processor,cppcms::mount_point("/up2/(.+)",1),cppcms::app::synchronous); > booster::weak_ptr<cppcms::application_specific_pool> > p_post_processor(post_processor); > sv.applications_pool().mount(cppcms::create_pool<part1>(p_post_processor),cppcms::mount_point("/up1",1),cppcms::app::asynchronous > | cppcms::app::content_filter); > > ... > } > > class part2 : public cppcms::rpc::json_rpc_server > { > private: > void part2::main(std::string url) > { > //"up2/abc" instead of "abc" is logged: > BOOSTER_DEBUG("url") << url; > /* > return_error() raises exception from > cppcms::rpc::json_rpc_server::check_call() > as follows: > > cppcms, error: Caught exception [JSON-RPC > Request is not assigned to class] > > This error seems to not occur to this version: > > class part2 : public cppcms::application{} > */ > return_error(""); > } > public: > part2(cppcms::service &s) > : cppcms::rpc::json_rpc_server(s){} > }; > > > class part1 : public cppcms::application > { > private: > booster::weak_ptr<cppcms::application_specific_pool> > app_specific_pool; > void main(std::string url); > public: > part1(cppcms::service > &s,booster::weak_ptr<cppcms::application_specific_pool> > app_specific_pool) > : cppcms::rpc::json_rpc_server(s) > { > booster::shared_ptr<cppcms::application_specific_pool> > pool=app_specific_pool.lock(); > if(pool){ > booster::shared_ptr<cppcms::http::context> > ctx=release_context(); > ctx->submit_to_pool(pool,"up2/abc"); > } > } > }; > > > A better formatted file is attached for your reference. > Helps will be much appreciated. > > Best Regards, > CN > > -- > http://www.fastmail.com - mmm... Fastmail... > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |