|
Fawkes API
Fawkes Development Version
|
Manage URL mappings. More...
#include <>>
Public Types | |
| typedef std::function< WebReply *(const WebRequest *)> | Handler |
| Function type for handling requests. More... | |
Public Member Functions | |
| WebUrlManager () | |
| Constructor. More... | |
| ~WebUrlManager () | |
| Destructor. More... | |
| void | add_handler (WebRequest::Method method, const std::string &path, Handler handler) |
| Add a request processor. More... | |
| void | remove_handler (WebRequest::Method method, const std::string &path) |
| Remove a request processor. More... | |
| void | add_handler (WebRequest::Method method, const std::string &path, Handler handler, int weight) |
| Add a request processor with weight. More... | |
Manage URL mappings.
This class maps (base) URLs to web request processors which handle all requests for the given URL.
Definition at line 39 of file url_manager.h.
| typedef std::function<WebReply *(const WebRequest *)> fawkes::WebUrlManager::Handler |
Function type for handling requests.
Definition at line 45 of file url_manager.h.
| fawkes::WebUrlManager::WebUrlManager | ( | ) |
Constructor.
Definition at line 37 of file url_manager.cpp.
| fawkes::WebUrlManager::~WebUrlManager | ( | ) |
Destructor.
Definition at line 42 of file url_manager.cpp.
| void fawkes::WebUrlManager::add_handler | ( | WebRequest::Method | method, |
| const std::string & | path, | ||
| Handler | handler | ||
| ) |
Add a request processor.
| method | HTTP method to register for |
| path | path pattern to register for, may contain {var}, {var*}, and {var+} elements |
| handler | handler function |
| Exception | thrown if a processor has already been registered for the given URL prefix. |
Definition at line 54 of file url_manager.cpp.
Referenced by MetricsThread::init(), WebviewThread::init(), XmlRpcThread::init(), WebviewRESTRequestProcessor::WebviewRESTRequestProcessor(), and WebviewStaticRequestProcessor::WebviewStaticRequestProcessor().
| void fawkes::WebUrlManager::add_handler | ( | WebRequest::Method | method, |
| const std::string & | path, | ||
| Handler | handler, | ||
| int | weight | ||
| ) |
Add a request processor with weight.
This one should mostly be necessary to implement "catch-all" handlers.
| method | HTTP method to register for |
| path | path pattern to register for, may contain {var}, {var*}, and {var+} elements |
| handler | handler function |
| weight | the higher the weight the later the handler will be tried. |
| Exception | thrown if a processor has already been registered for the given URL prefix. |
Definition at line 70 of file url_manager.cpp.
| void fawkes::WebUrlManager::remove_handler | ( | WebRequest::Method | method, |
| const std::string & | path | ||
| ) |
Remove a request processor.
| method | HTTP method to unregister from |
| path | path pattern to unregister from |
Definition at line 84 of file url_manager.cpp.
Referenced by MetricsThread::finalize(), WebviewThread::finalize(), XmlRpcThread::finalize(), WebviewRESTRequestProcessor::~WebviewRESTRequestProcessor(), and WebviewStaticRequestProcessor::~WebviewStaticRequestProcessor().