[Cppcms-users] URL dispatching help
Brought to you by:
artyom-beilis
|
From: Troy W. <dr...@gm...> - 2013-04-28 09:04:57
|
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!
|