MySQL 8.4.2
Source Code Documentation
HttpRequestRouter Class Reference

#include <http_request_router.h>

Inheritance diagram for HttpRequestRouter:
[legend]

Classes

struct  RouterData
 

Public Types

using RequestHandler = http::base::RequestHandler
 
using BaseRequestHandlerPtr = std::shared_ptr< http::base::RequestHandler >
 

Public Member Functions

void append (const std::string &url_regex_str, std::unique_ptr< RequestHandler > cb)
 Request router. More...
 
void remove (const void *handler_id)
 
void remove (const std::string &url_regex_str)
 
void set_default_route (std::unique_ptr< RequestHandler > cb)
 
void clear_default_route ()
 
void route (http::base::Request &req) override
 
void require_realm (const std::string &realm)
 
- Public Member Functions inherited from http::server::RequestHandlerInterface
virtual ~RequestHandlerInterface ()=default
 

Private Member Functions

void handler_not_found (http::base::Request &req)
 
BaseRequestHandlerPtr find_route_handler (const std::string &path)
 

Private Attributes

std::vector< RouterDatarequest_handlers_
 
BaseRequestHandlerPtr default_route_
 
std::string require_realm_
 
std::mutex route_mtx_
 

Member Typedef Documentation

◆ BaseRequestHandlerPtr

◆ RequestHandler

Member Function Documentation

◆ append()

void HttpRequestRouter::append ( const std::string &  url_regex_str,
std::unique_ptr< RequestHandler cb 
)

Request router.

send requests for a path of the URI to a handler callback

if no handler is found, reply with 404 not found

◆ clear_default_route()

void HttpRequestRouter::clear_default_route ( )

◆ find_route_handler()

BaseRequestHandlerPtr HttpRequestRouter::find_route_handler ( const std::string &  path)
private

◆ handler_not_found()

void HttpRequestRouter::handler_not_found ( http::base::Request req)
private

◆ remove() [1/2]

void HttpRequestRouter::remove ( const std::string &  url_regex_str)

◆ remove() [2/2]

void HttpRequestRouter::remove ( const void *  handler_id)

◆ require_realm()

void HttpRequestRouter::require_realm ( const std::string &  realm)
inline

◆ route()

void HttpRequestRouter::route ( http::base::Request req)
overridevirtual

◆ set_default_route()

void HttpRequestRouter::set_default_route ( std::unique_ptr< RequestHandler cb)

Member Data Documentation

◆ default_route_

BaseRequestHandlerPtr HttpRequestRouter::default_route_
private

◆ request_handlers_

std::vector<RouterData> HttpRequestRouter::request_handlers_
private

◆ require_realm_

std::string HttpRequestRouter::require_realm_
private

◆ route_mtx_

std::mutex HttpRequestRouter::route_mtx_
private

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