[Cppcms-users] Whats the role or url_mapper in cppcms
Brought to you by:
artyom-beilis
|
From: Neel B. <nee...@gm...> - 2013-08-16 18:23:24
|
In the example on http://cppcms.com/wikipp/en/page/cppcms_1x_tut_url_mapping it keeps a map of regex url pattern and its corresponding action with `dispatcher().assign()`. But what is the job of `mapper().assign()` ? even if I comment that out it works. In documentation it says > we create a name for this part called "number" and we provide a URL > formatting pattern /number/{1} - the opposite of regular expression > where {1} is a placeholder for the first parameter for formatting the > appropriate URL. But why create *a name for the part* and why its necessary ? hello(cppcms::service &srv): cppcms::application(srv){ dispatcher().assign("/number/(\\d+)",&hello::number,this,1); mapper().assign("number","/number/{1}"); dispatcher().assign("/smile",&hello::smile,this); mapper().assign("smile","/smile"); dispatcher().assign("",&hello::welcome,this); mapper().assign(""); mapper().root("/hello"); } Thanks - Neel |