19 #ifndef _SERVER_REQUEST_ROUTER_HPP
20 #define _SERVER_REQUEST_ROUTER_HPP
26 #include <boost/noncopyable.hpp>
27 #include <boost/shared_ptr.hpp>
52 requestHandlerMap[_handler->commandId()] = _handler;
62 std::string command = request.get<std::string>(
"kcm-cmd");
64 if(requestHandlerMap.find(command) != requestHandlerMap.end()) {
66 requestHandlerMap[command]->run(request, response);
67 }
catch (boost::property_tree::ptree_bad_path &e) {
69 response.put(
"kcm-erm", e.what());
73 response.put(
"kcm-erm",
"Unrecognized command: " + command);
75 }
catch (boost::property_tree::ptree_bad_path &e) {
77 response.put(
"kcm-erm", e.what());
89 (*retval)[itr->first] = itr->second->getDescription();
No matching identifier for the supplied value of kcm-cmd was found.
Definition: request_status.hpp:34
Definition: request_router.hpp:43
sharedRequestHandlerInfoList getHandlerDescriptions()
Definition: request_router.hpp:82
requestHandlerInfoList::iterator requestHandlerInfoListIter
Definition: request_router.hpp:38
used to indicate the absence of an expected parameter
Definition: request_status.hpp:36
std::map< std::string, RequestHandlerPtr > requestHandlerMapType
Definition: request_router.hpp:35
boost::property_tree::ptree BoostPtree
Definition: boost_ptree.hpp:31
boost::shared_ptr< RequestHandler > RequestHandlerPtr
Definition: request_handler.hpp:54
boost::shared_ptr< requestHandlerInfoList > sharedRequestHandlerInfoList
Definition: request_router.hpp:39
requestHandlerMapType::iterator requestHandlerMapTypeIter
Definition: request_router.hpp:36
Definition: logstream.hpp:145
std::map< std::string, std::string > requestHandlerInfoList
Definition: request_router.hpp:37
RequestRouter()
Definition: request_router.hpp:46
boost::shared_ptr< RequestRouter > sharedRequestRouter
Definition: request_router.hpp:99
void route_request(const BoostPtree &request, BoostPtree &response)
Definition: request_router.hpp:58
void register_handler(RequestHandlerPtr _handler)
Definition: request_router.hpp:49