Re: [Cppcms-users] Cppcms-users Digest, Vol 26, Issue 11
Brought to you by:
artyom-beilis
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 > > |