\section{cppcms\+:\+:url\+\_\+dispatcher Class Reference}
\label{classcppcms_1_1url__dispatcher}\index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}


This class is used to glue between member function of application class and urls.  




{\ttfamily \#include $<$cppcms/url\+\_\+dispatcher.\+h$>$}

Inheritance diagram for cppcms\+:\+:url\+\_\+dispatcher\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classcppcms_1_1url__dispatcher}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef {\bf booster\+::function}$<$ bool({\bf cppcms\+::application} \&, {\bf booster\+::cmatch} const \&)$>$ {\bf generic\+\_\+handler}
\begin{DoxyCompactList}\small\item\em R\+E\+S\+Tful A\+PI Handler that validates parameters and executes a method. \end{DoxyCompactList}\item 
typedef {\bf booster\+::function}$<$ void()$>$ {\bfseries handler}\label{classcppcms_1_1url__dispatcher_adc353cf8b6620e77767da76851a7a3c5}

\item 
typedef {\bf booster\+::function}$<$ void({\bf booster\+::cmatch} const \&)$>$ {\bfseries rhandler}\label{classcppcms_1_1url__dispatcher_abfbfd020f92e4891a6284c63052da770}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string)$>$ {\bfseries handler1}\label{classcppcms_1_1url__dispatcher_aceb427ad8c047668e6c2852f00366be9}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string, std\+::string)$>$ {\bfseries handler2}\label{classcppcms_1_1url__dispatcher_a951d46ef8fa723d55f1808f0a379bad3}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string, std\+::string, std\+::string)$>$ {\bfseries handler3}\label{classcppcms_1_1url__dispatcher_a82cff4dea749bf5659ff6211db3c2084}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string, std\+::string, std\+::string, std\+::string)$>$ {\bfseries handler4}\label{classcppcms_1_1url__dispatcher_a23a9bdc279312c9c66d92c6e8698da74}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string)$>$ {\bfseries handler5}\label{classcppcms_1_1url__dispatcher_ae6134552e5de32b35db2611c9cb7da62}

\item 
typedef {\bf booster\+::function}$<$ void(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string, std\+::string)$>$ {\bfseries handler6}\label{classcppcms_1_1url__dispatcher_a31710060b4d304600672bfaabac1627e}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
void {\bf map\+\_\+generic} (std\+::string const \&method, {\bf booster\+::regex} const \&re, {\bf generic\+\_\+handler} const \&h)
\item 
void {\bf map\+\_\+generic} ({\bf booster\+::regex} const \&re, {\bf generic\+\_\+handler} const \&h)
\item 
{\footnotesize template$<$typename Application , typename... Application\+Member\+Args$>$ }\\void {\bf map} (std\+::string const \&method, std\+::string const \&re, void(Application\+::$\ast$member)(Application\+Member\+Args...), Application $\ast$app, int...\+groups)
\begin{DoxyCompactList}\small\item\em Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re} and H\+T\+TP method {\itshape method}. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Application , typename... Application\+Member\+Args$>$ }\\void {\bf map} (std\+::string const \&re, void(Application\+::$\ast$member)(Application\+Member\+Args...), Application $\ast$app, int...\+groups)
\begin{DoxyCompactList}\small\item\em Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re}. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Application , typename... Application\+Member\+Args$>$ }\\void {\bf map} (std\+::string const \&method, {\bf booster\+::regex} const \&re, void(Application\+::$\ast$member)(Application\+Member\+Args...), Application $\ast$app, int...\+groups)
\begin{DoxyCompactList}\small\item\em Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re} and H\+T\+TP method {\itshape method}. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Application , typename... Application\+Member\+Args$>$ }\\void {\bf map} ({\bf booster\+::regex} const \&re, void(Application\+::$\ast$member)(Application\+Member\+Args...), Application $\ast$app, int...\+groups)
\begin{DoxyCompactList}\small\item\em Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re}. \end{DoxyCompactList}\item 
void {\bf assign\+\_\+generic} (std\+::string const \&regex, {\bf rhandler} {\bf handler})
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler} {\bf handler})
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler1} {\bf handler}, int exp1)
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler2} {\bf handler}, int exp1, int exp2)
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler3} {\bf handler}, int exp1, int exp2, int exp3)
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler4} {\bf handler}, int exp1, int exp2, int exp3, int exp4)
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler5} {\bf handler}, int exp1, int exp2, int exp3, int exp4, int exp5)
\item 
void {\bf assign} (std\+::string const \&regex, {\bf handler6} {\bf handler}, int exp1, int exp2, int exp3, int exp4, int exp5, int exp6)
\item 
bool {\bf dispatch} (std\+::string url)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(), C $\ast$object)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign\+\_\+generic} (std\+::string const \&regex, void(C\+::$\ast$member)({\bf booster\+::cmatch} const \&), C $\ast$object)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string), C $\ast$object, int e1)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string, std\+::string), C $\ast$object, int e1, int e2)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4, int e5)
\item 
{\footnotesize template$<$typename C $>$ }\\void {\bf assign} (std\+::string const \&regex, void(C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4, int e5, int e6)
\item 
void {\bf mount} (std\+::string const \&match, {\bf application} \&app, int part)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class is used to glue between member function of application class and urls. 

This class is used in context of {\itshape \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}} with its {\itshape url} member function. It uses regular expression to bind between url and callbacks that actually process the request. It also allows mount sub-\/applications to the root of the primary application.

There are two families of functions, assign and map. Older {\ttfamily assign} interface allows matching only U\+RL against regular expression. and passes std\+::string as parameter. All the validation must be performed by regular expression or the code that was called.

Newer {\ttfamily map} interface allows both matching an U\+RL and an H\+T\+TP request method. Parameters are parsed using {\ttfamily bool parse\+\_\+url\+\_\+parameter(util\+::const\+\_\+char\+\_\+istream \&parameter,\+Type \&param)} that by default uses std\+::istream to perform casting.

Additionally every matched parameter is checked to contain valid text encoding

Newer A\+PI uses map member functions family that was introduced in Cpp\+C\+MS 1.\+1.

For example\+:


\begin{DoxyCode}
\textcolor{keyword}{class }my\_web\_project : \textcolor{keyword}{public} cppcms::application \{
    users\_app users\_;
    \textcolor{comment}{/* Older Handlers */}
    \textcolor{keywordtype}{void} display\_page(std::string)
     ...
    \textcolor{comment}{/* Newer CppCMS 1.1 handlers */}
    \textcolor{keywordtype}{void} get\_resource(\textcolor{keywordtype}{int} \textcolor{keywordtype}{id});
    \textcolor{keywordtype}{void} update\_resource(\textcolor{keywordtype}{int} \textcolor{keywordtype}{id});
    \textcolor{keywordtype}{void} new\_resource();
    \textcolor{keywordtype}{void} id\_by\_name(std::string \textcolor{keyword}{const} &name); \textcolor{comment}{/* name checked for valid encoding */}
    \textcolor{keywordtype}{void} display\_page\_by\_id(\textcolor{keywordtype}{int} \textcolor{keywordtype}{id})
\textcolor{keyword}{public}:
   my\_web\_project() \{
    \textcolor{comment}{/* Older API */}
    dispatcher().assign(\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)/?"},&my\_web\_project::display\_page,\textcolor{keyword}{this},1);

    \textcolor{comment}{/* New API - CppCMS 1.1 and above */}

    dispatcher().map(\textcolor{stringliteral}{"GET"},\textcolor{stringliteral}{"/resource/(\(\backslash\)\(\backslash\)d+)"},&my\_web\_project::get\_resource,\textcolor{keyword}{this},1);
    dispatcher().map(\textcolor{stringliteral}{"PUT"},\textcolor{stringliteral}{"/resource/(\(\backslash\)\(\backslash\)d+)"},&my\_web\_project::update\_resource,\textcolor{keyword}{this},1);
    dispatcher().map(\textcolor{stringliteral}{"POST"},\textcolor{stringliteral}{"/resources"},&my\_web\_project::new\_resource,\textcolor{keyword}{this});
    dispatcher().map(\textcolor{stringliteral}{"GET"}.\textcolor{stringliteral}{"/id\_by\_name/(.*)"},&my\_web\_project::id\_by\_name,\textcolor{keyword}{this},1);
    dispatcher().map(\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)"},&my\_web\_project::display\_page\_by\_id,\textcolor{keyword}{this},1); \textcolor{comment}{/* any method */}
    ...
\end{DoxyCode}
 

\subsection{Member Typedef Documentation}
\index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!generic\+\_\+handler@{generic\+\_\+handler}}
\index{generic\+\_\+handler@{generic\+\_\+handler}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{generic\+\_\+handler}]{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf booster\+::function}$<$bool({\bf cppcms\+::application} \&,{\bf booster\+::cmatch} const \&)$>$ {\bf cppcms\+::url\+\_\+dispatcher\+::generic\+\_\+handler}}\label{classcppcms_1_1url__dispatcher_a07a56586b0ad33171dcb21c9e4d6d35c}


R\+E\+S\+Tful A\+PI Handler that validates parameters and executes a method. 

If validation fails it should return false and thus the matching would continue to next handler

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} 

\subsection{Member Function Documentation}
\index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler handler)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler}}]{handler}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a26279a7153679003f7ae88b1bbde9f90}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler1 handler, int exp1)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler1}}]{handler, }
\item[{int}]{exp1}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a563f4a27b3cdee54be5fc14ded009e5e}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with first parameters the string that was matched at position {\itshape exp1}.

For example\+: if regular expression is \char`\"{}$^\wedge$/page/(\textbackslash{}\textbackslash{}d+)/(\textbackslash{}\textbackslash{}w+)\$\char`\"{} , exp1=2, and the url is \char`\"{}/page/13/to\+\_\+be\+\_\+or\+\_\+not\char`\"{}, then handler would be called with \char`\"{}to\+\_\+be\+\_\+or\+\_\+not\char`\"{} as its first parameter \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler2 handler, int exp1, int exp2)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler2}}]{handler, }
\item[{int}]{exp1, }
\item[{int}]{exp2}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a2e26e1b17dc80a40a5467c028d1b40e9}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with 1st and 2nd parameters the string that was matched at position {\itshape exp1} and {\itshape exp2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler3 handler, int exp1, int exp2, int exp3)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler3}}]{handler, }
\item[{int}]{exp1, }
\item[{int}]{exp2, }
\item[{int}]{exp3}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a981b6b7695c0b90e58b7d8cf8cad07f4}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with 1st, 2nd and 3rd parameters the string that was matched at position {\itshape exp1}, {\itshape exp2} and {\itshape exp2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler4 handler, int exp1, int exp2, int exp3, int exp4)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler4}}]{handler, }
\item[{int}]{exp1, }
\item[{int}]{exp2, }
\item[{int}]{exp3, }
\item[{int}]{exp4}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_af5c9a3e6b3fcccc03df6a277522c541b}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with 1st, 2nd, 3rd and 4th parameters the string that was matched at position {\itshape exp1}, {\itshape exp2}, {\itshape exp3} and {\itshape exp4} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler5 handler, int exp1, int exp2, int exp3, int exp4, int exp5)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler5}}]{handler, }
\item[{int}]{exp1, }
\item[{int}]{exp2, }
\item[{int}]{exp3, }
\item[{int}]{exp4, }
\item[{int}]{exp5}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a43066f200226c3027e4aa0fa2c3467ad}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with 1st, 2nd, 3rd, 4th and 5th parameters the string that was matched at position {\itshape exp1}, {\itshape exp2}, {\itshape exp3}, {\itshape exp4} and {\itshape exp5} 

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, handler6 handler, int exp1, int exp2, int exp3, int exp4, int exp5, int exp6)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf handler6}}]{handler, }
\item[{int}]{exp1, }
\item[{int}]{exp2, }
\item[{int}]{exp3, }
\item[{int}]{exp4, }
\item[{int}]{exp5, }
\item[{int}]{exp6}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_afc027a9777999dbc945923f6d5dc21bc}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with 1st, 2nd, 3rd, 4th, 5th and 6th parameters the string that was matched at position {\itshape exp1}, {\itshape exp2}, {\itshape exp3}, {\itshape exp4}, {\itshape exp} 5 and {\itshape exp6} 

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(), C $\ast$object)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)()}]{member, }
\item[{C $\ast$}]{object}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a52c8ef6f90fda48b95b3f4abe1a92857}
This template function is a shortcut to assign(regex,callback). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler() as simple as assign(expr,\&bar\+::foo,this);

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string), C $\ast$object, int e1)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a09832dd54e25dc8dfa6794aebcff747b}
This template function is a shortcut to assign(regex,callback,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string, std\+::string), C $\ast$object, int e1, int e2)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string, std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1, }
\item[{int}]{e2}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a42f383a14c42874dde69ab9c025a77c6}
This template function is a shortcut to assign(regex,callback,int,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string,string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string, std\+::string, std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1, }
\item[{int}]{e2, }
\item[{int}]{e3}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a0bd4ff01bc9e362c14e456f4ca4d98bb}
This template function is a shortcut to assign(regex,callback,int,int,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string,string,string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string, std\+::string, std\+::string, std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1, }
\item[{int}]{e2, }
\item[{int}]{e3, }
\item[{int}]{e4}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a9bb18e0c70c84251e082204aa6a233ab}
This template function is a shortcut to assign(regex,callback,int,int,int,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string,string,string,string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4, int e5)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1, }
\item[{int}]{e2, }
\item[{int}]{e3, }
\item[{int}]{e4, }
\item[{int}]{e5}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_afe8ccb0fe8d430f88089ba4c1062d2fd}
This template function is a shortcut to assign(regex,callback,int,int,int,int,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string,string,string,string,string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign@{assign}}
\index{assign@{assign}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign(std\+::string const \&regex, void(\+C\+::$\ast$member)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string, std\+::string), C $\ast$object, int e1, int e2, int e3, int e4, int e5, int e6)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)(std\+::string, std\+::string, std\+::string, std\+::string, std\+::string, std\+::string)}]{member, }
\item[{C $\ast$}]{object, }
\item[{int}]{e1, }
\item[{int}]{e2, }
\item[{int}]{e3, }
\item[{int}]{e4, }
\item[{int}]{e5, }
\item[{int}]{e6}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a7f07165203fc44998c000ece32bfed1f}
This template function is a shortcut to assign(regex,callback,int,int,int,int,int,int). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(string,string,string,string,string,string)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} 

References cppcms\+::application\+::clear(), cppcms\+::parse\+\_\+url\+\_\+parameter(), and cppcms\+::util\+::const\+\_\+char\+\_\+istream\+::range().

\index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign\+\_\+generic@{assign\+\_\+generic}}
\index{assign\+\_\+generic@{assign\+\_\+generic}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign\+\_\+generic(std\+::string const \&regex, rhandler handler)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::assign\+\_\+generic (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{{\bf rhandler}}]{handler}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_aeca23bb1ae7a867990442fd061bab3ca}
Assign {\itshape handler} to pattern {\itshape regex} thus if U\+RL that matches this pattern requested, {\itshape handler} is called with matched results \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!assign\+\_\+generic@{assign\+\_\+generic}}
\index{assign\+\_\+generic@{assign\+\_\+generic}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{assign\+\_\+generic(std\+::string const \&regex, void(\+C\+::$\ast$member)(booster\+::cmatch const \&), C $\ast$object)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename C $>$ void cppcms\+::url\+\_\+dispatcher\+::assign\+\_\+generic (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{regex, }
\item[{void(C\+::$\ast$)({\bf booster\+::cmatch} const \&)}]{member, }
\item[{C $\ast$}]{object}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}\label{classcppcms_1_1url__dispatcher_a398ce181ecdaf470c2855dfccc4638ed}
This template function is a shortcut to assign\+\_\+generic(regex,rhandler). It allows assignment of {\itshape member} function of an {\itshape object} with signature void handler(booster\+::cmatch const \&)

In addition to calling {\itshape member} function it calls object-\/$>$init() before call and object-\/$>$clean() after the call of the C is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!dispatch@{dispatch}}
\index{dispatch@{dispatch}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{dispatch(std\+::string url)}]{\setlength{\rightskip}{0pt plus 5cm}bool cppcms\+::url\+\_\+dispatcher\+::dispatch (
\begin{DoxyParamCaption}
\item[{std\+::string}]{url}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_afa6b2ec987c0a230b17767c3220a5b22}
Try to find match between {\itshape url} and registered handlers and applications. If the match was found, it returns the method, how handler should bd dispatched synchronous or asynchronous, meaning the handler would be executed in thread pool or in the main non-\/blocking loop \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map@{map}}
\index{map@{map}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map(std\+::string const \&method, std\+::string const \&re, void(\+Application\+::$\ast$member)(\+Application\+Member\+Args...), Application $\ast$app, int...\+groups)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Application , typename... Application\+Member\+Args$>$ void cppcms\+::url\+\_\+dispatcher\+::map (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{method, }
\item[{std\+::string const \&}]{re, }
\item[{void(Application\+::$\ast$)(Application\+Member\+Args...)}]{member, }
\item[{Application $\ast$}]{app, }
\item[{int...}]{groups}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a494ce130c0266a395fd205206e7d2e81}


Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re} and H\+T\+TP method {\itshape method}. 


\begin{DoxyParams}{Parameters}
{\em method} & -\/ H\+T\+TP method to match like G\+ET, P\+O\+ST, note regular expression can be used as well, for example \char`\"{}(\+P\+O\+S\+T$\vert$\+P\+U\+T)\char`\"{} \\
\hline
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em member} & -\/ member function of application {\itshape app} \\
\hline
{\em app} & -\/ application that its {\itshape member} is called \\
\hline
{\em groups} & -\/ matched groups converted to Application\+Member\+Args\\
\hline
\end{DoxyParams}
Note\+:


\begin{DoxyItemize}
\item number of integers in {\itshape groups} should match the number of arguments of {\itshape member} 
\item {\itshape member} can have up to 8 arguments Member\+Args and the function should receive same number of integer parameters representing matched groups
\end{DoxyItemize}

For exaample 
\begin{DoxyCode}
\textcolor{keyword}{class }foo : \textcolor{keyword}{public} cppcms::application \{
    ...
   \textcolor{keywordtype}{void} page(\textcolor{keywordtype}{int} x,std::string \textcolor{keyword}{const} &name);
   \textcolor{keywordtype}{void} update(\textcolor{keywordtype}{int} x);
   foo(...) 
   \{
      dispatcher().map(\textcolor{stringliteral}{"GET"},\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)(/(.*))?"},&foo::page,\textcolor{keyword}{this},1,3);
      dispatcher().map(\textcolor{stringliteral}{"POST"},\textcolor{stringliteral}{"/update/(\(\backslash\)\(\backslash\)d+)"},&foo::update,\textcolor{keyword}{this},1);
   \}
\end{DoxyCode}


When the reuqest matches the {\itshape method} and regualr expression {\itshape re}, {\itshape member} of {\itshape app} is called, For case of {\ttfamily page} that has two parameters the first matched group is converted to integer and passed to as first parameter and 3rd group is passed as string to 2nd parameter

In case of {\ttfamily update} -\/ that has only 1 parameter, a single integer should be passed

In addition to calling {\itshape member} function it calls app-\/$>$init() before call and app-\/$>$clean() after the call if Application is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map@{map}}
\index{map@{map}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map(std\+::string const \&re, void(\+Application\+::$\ast$member)(\+Application\+Member\+Args...), Application $\ast$app, int...\+groups)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Application , typename... Application\+Member\+Args$>$ void cppcms\+::url\+\_\+dispatcher\+::map (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{re, }
\item[{void(Application\+::$\ast$)(Application\+Member\+Args...)}]{member, }
\item[{Application $\ast$}]{app, }
\item[{int...}]{groups}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_aad89b52e70d7fac9ce4e36a7d6cee76e}


Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re}. 


\begin{DoxyParams}{Parameters}
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em member} & -\/ member function of application {\itshape app} \\
\hline
{\em app} & -\/ application that its {\itshape member} is called \\
\hline
{\em groups} & -\/ matched groups converted to Application\+Member\+Args\\
\hline
\end{DoxyParams}
Note\+:


\begin{DoxyItemize}
\item number of integers in {\itshape groups} should match the number of arguments of {\itshape member} 
\item {\itshape member} can have up to 8 arguments Member\+Args and the function should receive same number of integer parameters representing matched groups
\end{DoxyItemize}

For exaample 
\begin{DoxyCode}
\textcolor{keyword}{class }foo : \textcolor{keyword}{public} cppcms::application \{
    ...
   \textcolor{keywordtype}{void} page(\textcolor{keywordtype}{int} x,std::string \textcolor{keyword}{const} &name);
   \textcolor{keywordtype}{void} update(\textcolor{keywordtype}{int} x);
   foo(...) 
   \{
      dispatcher().map(\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)(/(.*))?"},&foo::page,\textcolor{keyword}{this},1,3);
      dispatcher().map(\textcolor{stringliteral}{"/update/(\(\backslash\)\(\backslash\)d+)"},&foo::update,\textcolor{keyword}{this},1);
   \}
\end{DoxyCode}


When the reuqest U\+RL the regualr expression {\itshape re}, {\itshape member} of {\itshape app} is called, For case of {\ttfamily page} that has two parameters the first matched group is converted to integer and passed to as first parameter and 3rd group is passed as string to 2nd parameter

In case of {\ttfamily update} -\/ that has only 1 parameter, a single integer should be passed

In addition to calling {\itshape member} function it calls app-\/$>$init() before call and app-\/$>$clean() after the call if Application is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map@{map}}
\index{map@{map}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map(std\+::string const \&method, booster\+::regex const \&re, void(\+Application\+::$\ast$member)(\+Application\+Member\+Args...), Application $\ast$app, int...\+groups)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Application , typename... Application\+Member\+Args$>$ void cppcms\+::url\+\_\+dispatcher\+::map (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{method, }
\item[{{\bf booster\+::regex} const \&}]{re, }
\item[{void(Application\+::$\ast$)(Application\+Member\+Args...)}]{member, }
\item[{Application $\ast$}]{app, }
\item[{int...}]{groups}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a415a12474ff24c29263d525d94b40c2b}


Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re} and H\+T\+TP method {\itshape method}. 


\begin{DoxyParams}{Parameters}
{\em method} & -\/ H\+T\+TP method to match like G\+ET, P\+O\+ST, note regular expression can be used as well, for example \char`\"{}(\+P\+O\+S\+T$\vert$\+P\+U\+T)\char`\"{} \\
\hline
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em member} & -\/ member function of application {\itshape app} \\
\hline
{\em app} & -\/ application that its {\itshape member} is called \\
\hline
{\em groups} & -\/ matched groups converted to Application\+Member\+Args\\
\hline
\end{DoxyParams}
Note\+:


\begin{DoxyItemize}
\item number of integers in {\itshape groups} should match the number of arguments of {\itshape member} 
\item {\itshape member} can have up to 8 arguments Member\+Args and the function should receive same number of integer parameters representing matched groups
\end{DoxyItemize}

For exaample 
\begin{DoxyCode}
\textcolor{keyword}{class }foo : \textcolor{keyword}{public} cppcms::application \{
    ...
   \textcolor{keywordtype}{void} page(\textcolor{keywordtype}{int} x,std::string \textcolor{keyword}{const} &name);
   \textcolor{keywordtype}{void} update(\textcolor{keywordtype}{int} x);
   foo(...) 
   \{
      \textcolor{keyword}{using} booster::regex;
      dispatcher().map(regex(\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)(/(.*))?"},regex::icase),&foo::page,\textcolor{keyword}{this},1,3);
      dispatcher().map(\textcolor{stringliteral}{"POST"},\textcolor{stringliteral}{"/update/(\(\backslash\)\(\backslash\)d+)"},&foo::update,\textcolor{keyword}{this},1);
   \}
\end{DoxyCode}


When the reuqest matches the {\itshape method} and regualr expression {\itshape re}, {\itshape member} of {\itshape app} is called, For case of {\ttfamily page} that has two parameters the first matched group is converted to integer and passed to as first parameter and 3rd group is passed as string to 2nd parameter

In case of {\ttfamily update} -\/ that has only 1 parameter, a single integer should be passed

In addition to calling {\itshape member} function it calls app-\/$>$init() before call and app-\/$>$clean() after the call if Application is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map@{map}}
\index{map@{map}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map(booster\+::regex const \&re, void(\+Application\+::$\ast$member)(\+Application\+Member\+Args...), Application $\ast$app, int...\+groups)}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Application , typename... Application\+Member\+Args$>$ void cppcms\+::url\+\_\+dispatcher\+::map (
\begin{DoxyParamCaption}
\item[{{\bf booster\+::regex} const \&}]{re, }
\item[{void(Application\+::$\ast$)(Application\+Member\+Args...)}]{member, }
\item[{Application $\ast$}]{app, }
\item[{int...}]{groups}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a74c2964b32e006d6a212e7c2394c4814}


Map {\itshape member} of {\itshape app} as a U\+RL handler that matches regualr expression {\itshape re}. 


\begin{DoxyParams}{Parameters}
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em member} & -\/ member function of application {\itshape app} \\
\hline
{\em app} & -\/ application that its {\itshape member} is called \\
\hline
{\em groups} & -\/ matched groups converted to Application\+Member\+Args\\
\hline
\end{DoxyParams}
Note\+:


\begin{DoxyItemize}
\item number of integers in {\itshape groups} should match the number of arguments of {\itshape member} 
\item {\itshape member} can have up to 8 arguments Member\+Args and the function should receive same number of integer parameters representing matched groups
\end{DoxyItemize}

For exaample 
\begin{DoxyCode}
\textcolor{keyword}{class }foo : \textcolor{keyword}{public} cppcms::application \{
    ...
   \textcolor{keywordtype}{void} page(\textcolor{keywordtype}{int} x,std::string \textcolor{keyword}{const} &name);
   \textcolor{keywordtype}{void} update(\textcolor{keywordtype}{int} x);
   foo(...) 
   \{
      \textcolor{keyword}{using} booster::regex;
      dispatcher().map(regex(\textcolor{stringliteral}{"/page/(\(\backslash\)\(\backslash\)d+)(/(.*))?"},regex::icase),&foo::page,\textcolor{keyword}{this},1,3);
      dispatcher().map(\textcolor{stringliteral}{"/update/(\(\backslash\)\(\backslash\)d+)"},&foo::update,\textcolor{keyword}{this},1);
   \}
\end{DoxyCode}


When the reuqest U\+RL the regualr expression {\itshape re}, {\itshape member} of {\itshape app} is called, For case of {\ttfamily page} that has two parameters the first matched group is converted to integer and passed to as first parameter and 3rd group is passed as string to 2nd parameter

In case of {\ttfamily update} -\/ that has only 1 parameter, a single integer should be passed

In addition to calling {\itshape member} function it calls app-\/$>$init() before call and app-\/$>$clean() after the call if Application is derived from \doxyref{cppcms\+::application}{p.}{classcppcms_1_1application}

\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map\+\_\+generic@{map\+\_\+generic}}
\index{map\+\_\+generic@{map\+\_\+generic}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map\+\_\+generic(std\+::string const \&method, booster\+::regex const \&re, generic\+\_\+handler const \&h)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::map\+\_\+generic (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{method, }
\item[{{\bf booster\+::regex} const \&}]{re, }
\item[{{\bf generic\+\_\+handler} const \&}]{h}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a0c47297d9c60bdb2f7d55ec68fb9d3fa}
Map a callback {\itshape h} to a U\+RL matching regular expression {\itshape re} and an H\+T\+TP {\itshape method} 


\begin{DoxyParams}{Parameters}
{\em method} & -\/ H\+T\+TP method to match like G\+ET, P\+O\+ST, note regular expression can be used as well, for example \char`\"{}(\+P\+O\+S\+T$\vert$\+P\+U\+T)\char`\"{} \\
\hline
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em h} & -\/ handler to execute\\
\hline
\end{DoxyParams}
\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!map\+\_\+generic@{map\+\_\+generic}}
\index{map\+\_\+generic@{map\+\_\+generic}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{map\+\_\+generic(booster\+::regex const \&re, generic\+\_\+handler const \&h)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::map\+\_\+generic (
\begin{DoxyParamCaption}
\item[{{\bf booster\+::regex} const \&}]{re, }
\item[{{\bf generic\+\_\+handler} const \&}]{h}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a12e7eaba257ffb4934f94f7c5018fa99}
Map a callback {\itshape h} to a U\+RL matching regular expression {\itshape re} 


\begin{DoxyParams}{Parameters}
{\em re} & -\/ regular expression to match the U\+RL \\
\hline
{\em h} & -\/ handler to execute\\
\hline
\end{DoxyParams}
\doxyref{New in Cpp\+C\+MS 1.\+2}{p.}{v1_2} \index{cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}!mount@{mount}}
\index{mount@{mount}!cppcms\+::url\+\_\+dispatcher@{cppcms\+::url\+\_\+dispatcher}}
\subsubsection[{mount(std\+::string const \&match, application \&app, int part)}]{\setlength{\rightskip}{0pt plus 5cm}void cppcms\+::url\+\_\+dispatcher\+::mount (
\begin{DoxyParamCaption}
\item[{std\+::string const \&}]{match, }
\item[{{\bf application} \&}]{app, }
\item[{int}]{part}
\end{DoxyParamCaption}
)}\label{classcppcms_1_1url__dispatcher_a024f81412bbd9d6d1b61ebfabce8aa8c}
Mount a sub application {\itshape app} to the U\+RL dispatcher, using regular expression match.

When mounted the U\+RL is checked against match expression and then calls app.\+main(substr) where substr is the matched subexpression part. For example\+:


\begin{DoxyCode}
dispatcher().mount(\textcolor{stringliteral}{"/formums((/.*)?)"},forums,1);
\end{DoxyCode}


For example\+: for url /forums/page/3 it would call {\ttfamily forums\+::main} with value \char`\"{}/page/3\char`\"{} 

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
cppcms/url\+\_\+dispatcher.\+h\end{DoxyCompactItemize}
