http_request_handler.hpp
Go to the documentation of this file.
00001 #ifndef CPP_WEB_SERVER_HTTP_REQUEST_HANDLER_HPP
00002 #define CPP_WEB_SERVER_HTTP_REQUEST_HANDLER_HPP
00003 
00004 #include <boost/function.hpp>
00005 #include <boost/shared_ptr.hpp>
00006 #include "async_web_server_cpp/http_request.hpp"
00007 
00008 namespace async_web_server_cpp
00009 {
00010 
00011 class HttpConnection;
00012 
00013 typedef boost::function<void(const HttpRequest &, boost::shared_ptr<HttpConnection>, const char* begin, const char* end)> HttpServerRequestHandler;
00014 
00020 class HttpRequestHandlerGroup
00021 {
00022 public:
00023   typedef boost::function<bool(const HttpRequest &)> HandlerPredicate;
00024 
00025   HttpRequestHandlerGroup(HttpServerRequestHandler default_handler);
00026 
00027   void addHandlerForPath(const std::string &path_regex, HttpServerRequestHandler handler);
00028 
00029   void addHandler(HandlerPredicate predicate, HttpServerRequestHandler handler);
00030 
00031   void operator()(const HttpRequest &request, boost::shared_ptr<HttpConnection> connection, const char* begin, const char* end);
00032 
00033 private:
00034   HttpServerRequestHandler default_handler_;
00035   std::vector<std::pair<HandlerPredicate, HttpServerRequestHandler> > handlers_;
00036 };
00037 
00038 }
00039 
00040 #endif


async_web_server_cpp
Author(s): Mitchell Wills
autogenerated on Thu Aug 27 2015 12:27:39