Re: [Cppcms-users] how to parsing complex variables and its values in URL
Brought to you by:
artyom-beilis
|
From: Stanimir M. <sta...@zo...> - 2014-06-20 09:01:35
|
On Fri, Jun 20, 2014 at 10:22 AM, sergey lavrov <ccp...@gm...> wrote: > Dear Stanimir! Dear All! > > function request().get() doesn't return > std::multimap<std::string,std::string>. > There is two "get" member funtions. One with string param that is handy to get the parameter by name directly. The other is get() without params. Look at the link to the documentation. http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html#a36d72816584f61d3c5b7e510d61a5f58 The former returns form_type which is typedef std::multimap<std::string,std::string> cppcms::http::request::form_type <http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html#af80022c2dddaf68330eb7f3f23ec84fc> > probably you meant about request::getenv() function, that return > std::map<std::string,std::string>, but this function returns all CGI > variables. > > http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html#a92bc86f75e4e1f9480967ce3fd1e4f65 > > when using request::getenv() function all variables of requested URL and > it's values are all in one QUERY_STRING key. > so parsing QUERY_STRING with such complex associative array notations is > not trivial task. > for example for one of the request QUERY_STRING looks like, and its > nightmare to parse variable unknown length and unknown of numbers of > variables string: > > > draw=1&columns[0][data]=0&columns[0][name]=&columns[0][searchable]=false&columns[0][orderable]=false&columns[0][search][value]=&columns[0][search][regex]=false&columns[1][data]=1&columns[1][name]=&columns[1][searchable]=true&columns[1][orderable]=true&columns[1][search][value]=&columns[1][search][regex]=false&columns[2][data]=2&columns[2][name]=&columns[2][searchable]=true&columns[2][orderable]=true&columns[2][search][value]=&columns[2][search][regex]=false&columns[3][data]=3&columns[3][name]=&columns[3][searchable]=true&columns[3][orderable]=true&columns[3][search][value]=&columns[3][search][regex]=false&columns[4][data]=4&columns[4][name]=&columns[4][searchable]=true&columns[4][orderable]=true&columns[4][search][value]=&columns[4][search][regex]=false&order[0][column]=1&order[0][dir]=asc&start=0&length=10&search[value]=&search[regex]=false&_=1403203600182 > > So I still looking for solution. Or should I create feature request? > > Thanks in advance! > > > On Fri, Jun 20, 2014 at 9:13 AM, Stanimir Mladenov < > sta...@zo...> wrote: > >> You have request().get() -> >> http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1request.html#a36d72816584f61d3c5b7e510d61a5f58 >> >> which returns std::multimap<std::string,std::string> >> >> The first is your parameter name and the second its value. >> Note that a parameter could be any type serialized as string. Like an ISO >> Date (2014-05-24). >> It is you responsibility to parse those values and convert them to your >> appropriate c++ representation, since CppCms can't know every type you need. >> >> Stanimir >> >> >> On Thu, Jun 19, 2014 at 10:12 PM, sergey lavrov <ccp...@gm... >> > wrote: >> >>> Dear All! >>> >>> I need to parsing complex variables and its values in URL which have the >>> form like: >>> variable[index1][index2]...[indexN]=X, where index1-N,X could be >>> integer, string, boolean. >>> For example, such notation have new version of jquery DataTables 1.10.0. >>> http://datatables.net/manual/server-side >>> Also such associative array notations using in variables in forms. >>> >>> What is the best way to parse such complex variables and its values? >>> >>> The best option for me is packing variables and it's values from URL to >>> c++ structures as is done in php and other languages. >>> Unfortunately cppcms::http::request or other classes haven't such >>> functionality. >>> >>> Thanks in advance! >>> >>> >>> ------------------------------------------------------------------------------ >>> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions >>> Find What Matters Most in Your Big Data with HPCC Systems >>> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >>> Leverages Graph Analysis for Fast Processing & Easy Data Exploration >>> http://p.sf.net/sfu/hpccsystems >>> _______________________________________________ >>> Cppcms-users mailing list >>> Cpp...@li... >>> https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >> >> >> ------------------------------------------------------------------------------ >> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions >> Find What Matters Most in Your Big Data with HPCC Systems >> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. >> Leverages Graph Analysis for Fast Processing & Easy Data Exploration >> http://p.sf.net/sfu/hpccsystems >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> > > > ------------------------------------------------------------------------------ > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://p.sf.net/sfu/hpccsystems > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > > |