Thread: Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 11
Brought to you by:
artyom-beilis
From: 刘怀宇 <mys...@gm...> - 2011-09-10 06:02:15
|
Hello Artyom , I try JSON_RPC over JSONP by the sample you proposed! cppcms::http::request& r = request(); string name = "method"; r.get(name); But I met a serious error. 2011/9/9 <cpp...@li...> > Send Cppcms-users mailing list submissions to > cpp...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/cppcms-users > or, via email, send a message with subject or body 'help' to > cpp...@li... > > You can reach the person managing the list at > cpp...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Cppcms-users digest..." > > > Today's Topics: > > 1. Re: Cppcms-users Digest, Vol 26, Issue 8 (Artyom Beilis) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 8 Sep 2011 10:56:20 -0700 (PDT) > From: Artyom Beilis <art...@ya...> > Subject: Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 8 > To: cpp...@li... > Message-ID: > <131...@we...> > Content-Type: text/plain; charset=iso-8859-1 > > > Hello,Artyom:? ? My Java developers told me they solved the > > cross-domain problem using JSONP. Does CppCMS support it? > > I mean JSON_RPC over JSONP.?Or do you have any better > > idea for this problem? > > CppCMS Supports JSON-RPC over HTTP via POST requests. > > So basically that means if you want to implement JSONP > you will just to need to handle it on your own. > > It should be quite trivial to implement with existing > JSON support. (See sample below) > > Now you should remember that: > > 1. JSONP may expose the application to many security problems. > 2. GET requests have limited size this you'll have problems > passing big parameters. > > So it should not be a problem to use but it has no real connection > to JSON-RPC. > > Artyom > -------------------------- > > void main(std::string url) > { > wrapper_function = request().get("jsonp"); > std::string method = request().get("method"); > cppcms::json::value params; > { > std::istringstream params(request().get("params")); > if(!v.load(params,true)) { > response().make_error_response(503); > return; > } > } > > response.out() << wrapper_function <<'('; > if(method=="sum") > sum(v); > else if > ... > response.out() << '); > > } > void sum(json::value const &v) { > int x = v[0].number(); > int y = v[0].number(); > json::value res = x+y; > response.out() << res; > } > > > ------------- > > > <script src=" > http://someurl.com/rpc?method=sum&wrapper=parseRequest&parms=[10,20] > "></script> > > > > > > > > > ------------------------------ > > > ------------------------------------------------------------------------------ > Why Cloud-Based Security and Archiving Make Sense > Osterman Research conducted this study that outlines how and why cloud > computing security and archiving is rapidly being adopted across the IT > space for its ease of implementation, lower cost, and increased > reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ > > ------------------------------ > > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > End of Cppcms-users Digest, Vol 26, Issue 11 > ******************************************** > |
From: 刘怀宇 <mys...@gm...> - 2011-09-10 06:23:05
|
2011/9/10 刘怀宇 <mys...@gm...> > Hello Artyom , I try JSON_RPC over JSONP by the sample you proposed! > But I met a error when I use get() of the cppcms::http::request > std::string get<http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1request.html#9558b7cf069445329bf5c3a7cc8e4044> (std::string > const &name) > Here is the code: cppcms::http::request& r = request(); > string name = "method"; > r.get(name); > > The error is : Undefined reference to `cppcms::http::request::get(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&)' > > I have already include the link library libcppcms.so .Do you hava any idea > about this problem? > > > 2011/9/9 <cpp...@li...> > > Send Cppcms-users mailing list submissions to >> cpp...@li... >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> or, via email, send a message with subject or body 'help' to >> cpp...@li... >> >> You can reach the person managing the list at >> cpp...@li... >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of Cppcms-users digest..." >> >> >> Today's Topics: >> >> 1. Re: Cppcms-users Digest, Vol 26, Issue 8 (Artyom Beilis) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 8 Sep 2011 10:56:20 -0700 (PDT) >> From: Artyom Beilis <art...@ya...> >> Subject: Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 8 >> To: cpp...@li... >> Message-ID: >> <131...@we...> >> Content-Type: text/plain; charset=iso-8859-1 >> >> > Hello,Artyom:? ? My Java developers told me they solved the >> > cross-domain problem using JSONP. Does CppCMS support it? >> > I mean JSON_RPC over JSONP.?Or do you have any better >> > idea for this problem? >> >> CppCMS Supports JSON-RPC over HTTP via POST requests. >> >> So basically that means if you want to implement JSONP >> you will just to need to handle it on your own. >> >> It should be quite trivial to implement with existing >> JSON support. (See sample below) >> >> Now you should remember that: >> >> 1. JSONP may expose the application to many security problems. >> 2. GET requests have limited size this you'll have problems >> passing big parameters. >> >> So it should not be a problem to use but it has no real connection >> to JSON-RPC. >> >> Artyom >> -------------------------- >> >> void main(std::string url) >> { >> wrapper_function = request().get("jsonp"); >> std::string method = request().get("method"); >> cppcms::json::value params; >> { >> std::istringstream params(request().get("params")); >> if(!v.load(params,true)) { >> response().make_error_response(503); >> return; >> } >> } >> >> response.out() << wrapper_function <<'('; >> if(method=="sum") >> sum(v); >> else if >> ... >> response.out() << '); >> >> } >> void sum(json::value const &v) { >> int x = v[0].number(); >> int y = v[0].number(); >> json::value res = x+y; >> response.out() << res; >> } >> >> >> ------------- >> >> >> <script src=" >> http://someurl.com/rpc?method=sum&wrapper=parseRequest&parms=[10,20] >> "></script> >> >> >> >> >> >> >> >> >> ------------------------------ >> >> >> ------------------------------------------------------------------------------ >> Why Cloud-Based Security and Archiving Make Sense >> Osterman Research conducted this study that outlines how and why cloud >> computing security and archiving is rapidly being adopted across the IT >> space for its ease of implementation, lower cost, and increased >> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ >> >> ------------------------------ >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> End of Cppcms-users Digest, Vol 26, Issue 11 >> ******************************************** >> > > |
From: 刘怀宇 <mys...@gm...> - 2011-09-10 06:59:34
|
I'm so Sorry .I sent two emails to you, just read the second one! |
From: 陈抒 <csf...@gm...> - 2011-09-10 07:20:45
|
I modified the example project hello_world,also couldn't use request().get(string const&) method correctly. void my_hello_world::main(std::string /*url*/) { cppcms::http::request & r = request(); std::string str = r.get("ok"); response().out()<< "<html>\n" "<body>\n" " <h1>Hello World</h1>\n" "</body>\n" "</html>\n"; } Got some error messages: /usr/local/src/cppcms-0.99.10/examples/hello_world $ make g++ -O2 -Wall -g hello.cpp -o hello -lcppcms -lbooster hello.cpp: In member function ‘virtual void my_hello_world::main(std::string)’: hello.cpp:19:21: error: invalid use of incomplete type ‘struct cppcms::http::request’ /usr/local/include/cppcms/application.h:52:9: error: forward declaration of ‘struct cppcms::http::request’ hello.cpp:19:14: warning: unused variable ‘str’ [-Wunused-variable] make: *** [hello] Error 1 陈抒 Best regards http://blog.csdn.net/sheismylife On Sat, Sep 10, 2011 at 2:02 PM, 刘怀宇 <mys...@gm...> wrote: > Hello Artyom , I try JSON_RPC over JSONP by the sample you proposed! > > cppcms::http::request& r = request(); > string name = "method"; > r.get(name); > > But I met a serious error. > > > > > 2011/9/9 <cpp...@li...> > >> Send Cppcms-users mailing list submissions to >> cpp...@li... >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> or, via email, send a message with subject or body 'help' to >> cpp...@li... >> >> You can reach the person managing the list at >> cpp...@li... >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of Cppcms-users digest..." >> >> >> Today's Topics: >> >> 1. Re: Cppcms-users Digest, Vol 26, Issue 8 (Artyom Beilis) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 8 Sep 2011 10:56:20 -0700 (PDT) >> From: Artyom Beilis <art...@ya...> >> Subject: Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 8 >> To: cpp...@li... >> Message-ID: >> <131...@we...> >> Content-Type: text/plain; charset=iso-8859-1 >> >> > Hello,Artyom:? ? My Java developers told me they solved the >> > cross-domain problem using JSONP. Does CppCMS support it? >> > I mean JSON_RPC over JSONP.?Or do you have any better >> > idea for this problem? >> >> CppCMS Supports JSON-RPC over HTTP via POST requests. >> >> So basically that means if you want to implement JSONP >> you will just to need to handle it on your own. >> >> It should be quite trivial to implement with existing >> JSON support. (See sample below) >> >> Now you should remember that: >> >> 1. JSONP may expose the application to many security problems. >> 2. GET requests have limited size this you'll have problems >> passing big parameters. >> >> So it should not be a problem to use but it has no real connection >> to JSON-RPC. >> >> Artyom >> -------------------------- >> >> void main(std::string url) >> { >> wrapper_function = request().get("jsonp"); >> std::string method = request().get("method"); >> cppcms::json::value params; >> { >> std::istringstream params(request().get("params")); >> if(!v.load(params,true)) { >> response().make_error_response(503); >> return; >> } >> } >> >> response.out() << wrapper_function <<'('; >> if(method=="sum") >> sum(v); >> else if >> ... >> response.out() << '); >> >> } >> void sum(json::value const &v) { >> int x = v[0].number(); >> int y = v[0].number(); >> json::value res = x+y; >> response.out() << res; >> } >> >> >> ------------- >> >> >> <script src=" >> http://someurl.com/rpc?method=sum&wrapper=parseRequest&parms=[10,20] >> "></script> >> >> >> >> >> >> >> >> >> ------------------------------ >> >> >> ------------------------------------------------------------------------------ >> Why Cloud-Based Security and Archiving Make Sense >> Osterman Research conducted this study that outlines how and why cloud >> computing security and archiving is rapidly being adopted across the IT >> space for its ease of implementation, lower cost, and increased >> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ >> >> ------------------------------ >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> End of Cppcms-users Digest, Vol 26, Issue 11 >> ******************************************** >> > > > > ------------------------------------------------------------------------------ > Malware Security Report: Protecting Your Business, Customers, and the > Bottom Line. Protect your business and customers by understanding the > threat from malware and how it can impact your online business. > http://www.accelacomm.com/jaw/sfnl/114/51427462/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: 陈抒 <csf...@gm...> - 2011-09-10 08:08:01
|
I figured out the real reason. We have one old cppcms version installed in our computer.After removed them,everything is OK. 陈抒 Best regards http://blog.csdn.net/sheismylife On Sat, Sep 10, 2011 at 2:02 PM, 刘怀宇 <mys...@gm...> wrote: > Hello Artyom , I try JSON_RPC over JSONP by the sample you proposed! > > cppcms::http::request& r = request(); > string name = "method"; > r.get(name); > > But I met a serious error. > > > > > 2011/9/9 <cpp...@li...> > >> Send Cppcms-users mailing list submissions to >> cpp...@li... >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> or, via email, send a message with subject or body 'help' to >> cpp...@li... >> >> You can reach the person managing the list at >> cpp...@li... >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of Cppcms-users digest..." >> >> >> Today's Topics: >> >> 1. Re: Cppcms-users Digest, Vol 26, Issue 8 (Artyom Beilis) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 8 Sep 2011 10:56:20 -0700 (PDT) >> From: Artyom Beilis <art...@ya...> >> Subject: Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 8 >> To: cpp...@li... >> Message-ID: >> <131...@we...> >> Content-Type: text/plain; charset=iso-8859-1 >> >> > Hello,Artyom:? ? My Java developers told me they solved the >> > cross-domain problem using JSONP. Does CppCMS support it? >> > I mean JSON_RPC over JSONP.?Or do you have any better >> > idea for this problem? >> >> CppCMS Supports JSON-RPC over HTTP via POST requests. >> >> So basically that means if you want to implement JSONP >> you will just to need to handle it on your own. >> >> It should be quite trivial to implement with existing >> JSON support. (See sample below) >> >> Now you should remember that: >> >> 1. JSONP may expose the application to many security problems. >> 2. GET requests have limited size this you'll have problems >> passing big parameters. >> >> So it should not be a problem to use but it has no real connection >> to JSON-RPC. >> >> Artyom >> -------------------------- >> >> void main(std::string url) >> { >> wrapper_function = request().get("jsonp"); >> std::string method = request().get("method"); >> cppcms::json::value params; >> { >> std::istringstream params(request().get("params")); >> if(!v.load(params,true)) { >> response().make_error_response(503); >> return; >> } >> } >> >> response.out() << wrapper_function <<'('; >> if(method=="sum") >> sum(v); >> else if >> ... >> response.out() << '); >> >> } >> void sum(json::value const &v) { >> int x = v[0].number(); >> int y = v[0].number(); >> json::value res = x+y; >> response.out() << res; >> } >> >> >> ------------- >> >> >> <script src=" >> http://someurl.com/rpc?method=sum&wrapper=parseRequest&parms=[10,20] >> "></script> >> >> >> >> >> >> >> >> >> ------------------------------ >> >> >> ------------------------------------------------------------------------------ >> Why Cloud-Based Security and Archiving Make Sense >> Osterman Research conducted this study that outlines how and why cloud >> computing security and archiving is rapidly being adopted across the IT >> space for its ease of implementation, lower cost, and increased >> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ >> >> ------------------------------ >> >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> End of Cppcms-users Digest, Vol 26, Issue 11 >> ******************************************** >> > > > > ------------------------------------------------------------------------------ > Malware Security Report: Protecting Your Business, Customers, and the > Bottom Line. Protect your business and customers by understanding the > threat from malware and how it can impact your online business. > http://www.accelacomm.com/jaw/sfnl/114/51427462/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |
From: augustin <aug...@ov...> - 2011-09-10 08:35:29
|
親愛的 刘怀宇, If you are going to participate in this list's discussion, I think it would be helpful to everyone if you did not subscribe to the daily digest. Your email subject lines "Cppcms-users Digest, Vol 26, Issue 11" does not help future readers going through the archives in deciding what the content of the email would be. Please, subscribe to receive individual mails. Also, you don't need to include the whole daily digest in your email. Snip appropriately the emails you reply to in order to keep a small citation that would be enough to give some context to your email. Thankfully, Artyom takes the extra trouble or replying to you by redacting a new email with an appropriate subject line. I trust your English is good enough to understand what I wrote. If you have troubles understanding, let me know and I'll translate it all in Chinese. 謝謝你的合作。 Blessings, Augustin. |