Re: [Cppcms-users] URL dispatching help
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-04-28 09:13:12
|
If you need two parameters i.e. go(std::string id,std::string urd) that you need provide sleections for both, i.e. dispatcher().assign( "/go/(\\d+)(.*)", &application::go, this, 1, 2 ); Where 1 - is first selected subexpression and 2 is the second one. Also I'm not sure but it seems that you need go(std::string id,std::string url) without const. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Troy Watson <dr...@gm...> >To: cpp...@li... >Sent: Sunday, April 28, 2013 12:04 PM >Subject: [Cppcms-users] URL dispatching help > > > >Despite reading the docs and looking at the examples, I can't figure out complex dispatching/mapping with regexes. I need some help please! > > >My callback member function looks like this: void go( const std::string id, const std::string url ) { ... } >And the URL to map to the function looks like this: /go/{integer id}/{string url} > > >For example: >/go/10/http://google.com - id=10, url=http://google.com >/go/2921/http://sourceforge.net - id=2921, url=http://sourceforge.net > > >The best I could come up with was this: > > > dispatcher().assign( "/go/(\\d+)(.*)", &application::go, this, 2 ); > > mapper().assign( "go", "/go/{1}/{2}" ); > > >...but obviously that doesn't compile. What should the dispatcher and mapper call look like to get the functionality I'm looking for? > > >Thank you for such an excellent framework! >------------------------------------------------------------------------------ >Try New Relic Now & We'll Send You this Cool Shirt >New Relic is the only SaaS-based application performance monitoring service >that delivers powerful full stack analytics. Optimize and monitor your >browser, app, & servers with just a few lines of code. Try New Relic >and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |