My Project
 All Classes Functions Variables Pages
Public Member Functions | List of all members
PathHandler Class Reference

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...
 

Detailed Description

Handle path matching for an incoming HTTP request.

Constructor & Destructor Documentation

PathHandler::PathHandler ( std::string  method,
std::string  matchPath,
void(*)(HttpRequest *pHttpRequest, HttpResponse *pHttpResponse)  pWebServerRequestHandler 
)

Construct an instance of a PathHandler.

Parameters
[in]methodThe method to be matched.
[in]pathPatternThe path to be matched. Must be an exact match.
[in]webServerRequestHandlerThe 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.

Parameters
[in]methodThe method to be matched.
[in]pathPatternThe path pattern to be matched.
[in]webServerRequestHandlerThe request handler to be called.

Member Function Documentation

void PathHandler::invokePathHandler ( HttpRequest request,
HttpResponse response 
)

Invoke the handler.

Parameters
[in]requestAn object representing the request.
[in]responseAn object representing the response.
Returns
N/A.
bool PathHandler::match ( std::string  method,
std::string  path 
)

Determine if the path matches.

Parameters
[in]methodThe method to be matched.
[in]pathThe path to be matched.
Returns
True if the path matches.

The documentation for this class was generated from the following files: