Fawkes API Fawkes Development Version
|
URL path router. More...
#include <router.h>
Public Member Functions | |
T & | find_handler (const WebRequest *request, std::map< std::string, std::string > &path_args) |
Find a handler. More... | |
T & | find_handler (WebRequest::Method method, const std::string &path, std::map< std::string, std::string > &path_args) |
Find a handler. More... | |
void | add (WebRequest::Method method, const std::string &path, T handler, int weight) |
Add a handler with weight. More... | |
void | add (WebRequest::Method method, const std::string &path, T handler) |
Add a handler. More... | |
void | remove (WebRequest::Method method, const std::string &path) |
Remove a handler. More... | |
URL path router.
Register URL path patterns and some handler or item. Then match it later to request URLs to retrieve this very handler or item if the pattern matches the URL.
|
inline |
Add a handler.
method | HTTP method to match for |
path | path pattern. A pattern may contain "{var}" segments for a URL. These will match an element of the path, i.e., a string not containing a slash. If a pattern has the form {var+} then it may contain a slash and therefore match multiple path segments. The handler would receive an entry named "var" in the parameters path arguments. |
handler | handler to store |
Definition at line 127 of file router.h.
References fawkes::WebviewRouter< T >::add().
|
inline |
Add a handler with weight.
method | HTTP method to match for |
path | path pattern. A pattern may contain "{var}" segments for a URL. These will match an element of the path, i.e., a string not containing a slash. If a pattern has the form {var+} then it may contain a slash and therefore match multiple path segments. The handler would receive an entry named "var" in the parameters path arguments. |
handler | handler to store |
weight | higher weight means the handler is tried later by the router. The default is 0. |
Definition at line 103 of file router.h.
Referenced by fawkes::WebviewRouter< T >::add().
|
inline |
Find a handler.
request | incoming request object |
path_args | upon successful completion, will contain mappings from path patterns to matched segments of the URL. |
NullPointerException | thrown if no handler could be found |
|
inline |
Find a handler.
method | HTTP method of the request |
path | path to match against stored paths |
path_args | upon successful completion, will contain mappings from path patterns to matched segments of the URL. |
NullPointerException | thrown if no handler could be found |
|
inline |