Handle path matching for an incoming HTTP request. More...
#include <HttpServer.h>
Public Member Functions | |
| PathHandler (std::string method, std::string pathPattern, void(*pWebServerRequestHandler)(HttpRequest *pHttpRequest, HttpResponse *pHttpResponse)) | |
| Construct an instance of a PathHandler. More... | |
| PathHandler (std::string method, std::regex *pathPattern, void(*pWebServerRequestHandler)(HttpRequest *pHttpRequest, HttpResponse *pHttpResponse)) | |
| Construct an instance of a PathHandler. More... | |
| bool | match (std::string method, std::string path) |
| Determine if the path matches. More... | |
| void | invokePathHandler (HttpRequest *request, HttpResponse *response) |
| Invoke the handler. More... | |
Handle path matching for an incoming HTTP request.
| PathHandler::PathHandler | ( | std::string | method, |
| std::string | matchPath, | ||
| void(*)(HttpRequest *pHttpRequest, HttpResponse *pHttpResponse) | pWebServerRequestHandler | ||
| ) |
Construct an instance of a PathHandler.
| [in] | method | The method to be matched. |
| [in] | pathPattern | The path to be matched. Must be an exact match. |
| [in] | webServerRequestHandler | The request handler to be called. |
| PathHandler::PathHandler | ( | std::string | method, |
| std::regex * | pRegex, | ||
| void(*)(HttpRequest *pHttpRequest, HttpResponse *pHttpResponse) | pWebServerRequestHandler | ||
| ) |
Construct an instance of a PathHandler.
| [in] | method | The method to be matched. |
| [in] | pathPattern | The path pattern to be matched. |
| [in] | webServerRequestHandler | The request handler to be called. |
| void PathHandler::invokePathHandler | ( | HttpRequest * | request, |
| HttpResponse * | response | ||
| ) |
Invoke the handler.
| [in] | request | An object representing the request. |
| [in] | response | An object representing the response. |
| bool PathHandler::match | ( | std::string | method, |
| std::string | path | ||
| ) |
Determine if the path matches.
| [in] | method | The method to be matched. |
| [in] | path | The path to be matched. |
1.8.6