Public Types | Public Member Functions | Private Attributes | List of all members
async_web_server_cpp::HttpRequestHandlerGroup Class Reference

#include <http_request_handler.hpp>

Public Types

typedef boost::function< bool(const HttpRequest &)> HandlerPredicate
 

Public Member Functions

void addHandler (HandlerPredicate predicate, HttpServerRequestHandler handler)
 
void addHandlerForPath (const std::string &path_regex, HttpServerRequestHandler handler)
 
 HttpRequestHandlerGroup (HttpServerRequestHandler default_handler)
 
bool operator() (const HttpRequest &request, boost::shared_ptr< HttpConnection > connection, const char *begin, const char *end)
 

Private Attributes

HttpServerRequestHandler default_handler_
 
std::vector< std::pair< HandlerPredicate, HttpServerRequestHandler > > handlers_
 

Detailed Description

A hander that can dispatch to a request to different handlers depending on a predicate. If none of registered handlers satisfy the request then the default request handler is used.

Definition at line 30 of file http_request_handler.hpp.

Member Typedef Documentation

◆ HandlerPredicate

Definition at line 33 of file http_request_handler.hpp.

Constructor & Destructor Documentation

◆ HttpRequestHandlerGroup()

async_web_server_cpp::HttpRequestHandlerGroup::HttpRequestHandlerGroup ( HttpServerRequestHandler  default_handler)

Definition at line 20 of file http_request_handler.cpp.

Member Function Documentation

◆ addHandler()

void async_web_server_cpp::HttpRequestHandlerGroup::addHandler ( HandlerPredicate  predicate,
HttpServerRequestHandler  handler 
)

Definition at line 49 of file http_request_handler.cpp.

◆ addHandlerForPath()

void async_web_server_cpp::HttpRequestHandlerGroup::addHandlerForPath ( const std::string &  path_regex,
HttpServerRequestHandler  handler 
)

Definition at line 43 of file http_request_handler.cpp.

◆ operator()()

bool async_web_server_cpp::HttpRequestHandlerGroup::operator() ( const HttpRequest request,
boost::shared_ptr< HttpConnection connection,
const char *  begin,
const char *  end 
)

Definition at line 55 of file http_request_handler.cpp.

Member Data Documentation

◆ default_handler_

HttpServerRequestHandler async_web_server_cpp::HttpRequestHandlerGroup::default_handler_
private

Definition at line 48 of file http_request_handler.hpp.

◆ handlers_

std::vector<std::pair<HandlerPredicate, HttpServerRequestHandler> > async_web_server_cpp::HttpRequestHandlerGroup::handlers_
private

Definition at line 50 of file http_request_handler.hpp.


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


async_web_server_cpp
Author(s): Mitchell Wills , Russel Toris
autogenerated on Tue Mar 1 2022 23:49:07