http_request_handler.hpp
Go to the documentation of this file.
1 #ifndef CPP_WEB_SERVER_HTTP_REQUEST_HANDLER_HPP
2 #define CPP_WEB_SERVER_HTTP_REQUEST_HANDLER_HPP
3 
5 
6 #include <boost/function.hpp>
7 #include <boost/shared_ptr.hpp>
8 
9 namespace async_web_server_cpp
10 {
11 
13 
20 typedef boost::function<bool(const HttpRequest&,
21  boost::shared_ptr<HttpConnection>,
22  const char* begin, const char* end)>
24 
31 {
32 public:
33  typedef boost::function<bool(const HttpRequest&)> HandlerPredicate;
34 
35  HttpRequestHandlerGroup(HttpServerRequestHandler default_handler);
36 
37  void addHandlerForPath(const std::string& path_regex,
38  HttpServerRequestHandler handler);
39 
40  void addHandler(HandlerPredicate predicate,
41  HttpServerRequestHandler handler);
42 
43  bool operator()(const HttpRequest& request,
44  boost::shared_ptr<HttpConnection> connection,
45  const char* begin, const char* end);
46 
47 private:
48  HttpServerRequestHandler default_handler_;
49  std::vector<std::pair<HandlerPredicate, HttpServerRequestHandler>>
51 };
52 
54 {
55 public:
56  typedef boost::function<void(const HttpRequest&,
57  boost::shared_ptr<HttpConnection>,
58  const std::string& body)>
60 
62 
63  bool operator()(const HttpRequest& request,
64  boost::shared_ptr<HttpConnection> connection,
65  const char* begin, const char* end);
66 
67 private:
69 };
70 
71 } // namespace async_web_server_cpp
72 
73 #endif
void addHandler(HandlerPredicate predicate, HttpServerRequestHandler handler)
boost::function< bool(const HttpRequest &)> HandlerPredicate
bool operator()(const HttpRequest &request, boost::shared_ptr< HttpConnection > connection, const char *begin, const char *end)
boost::function< void(const HttpRequest &, boost::shared_ptr< HttpConnection >, const std::string &body)> Handler
std::vector< std::pair< HandlerPredicate, HttpServerRequestHandler > > handlers_
HttpRequestHandlerGroup(HttpServerRequestHandler default_handler)
boost::function< bool(const HttpRequest &, boost::shared_ptr< HttpConnection >, const char *begin, const char *end)> HttpServerRequestHandler
void addHandlerForPath(const std::string &path_regex, HttpServerRequestHandler handler)


async_web_server_cpp
Author(s): Mitchell Wills , Russel Toris
autogenerated on Mon Feb 28 2022 21:54:08