KISSCPP
a C++ library for rapid application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
standard_handlers.hpp
Go to the documentation of this file.
1 #ifndef _STANDARD_HANDLERS_HPP_
2 #define _STANDARD_HANDLERS_HPP_
3 
4 #include <iostream>
5 #include <string>
6 #include <unistd.h>
7 #include <boost/shared_ptr.hpp>
8 #include <boost/algorithm/string.hpp>
9 
10 #include "logstream.hpp"
11 #include "request_handler.hpp"
12 #include "request_router.hpp"
13 #include "boost_ptree.hpp"
14 #include "request_status.hpp"
15 #include "statskeeper.hpp"
16 #include "errorstate.hpp"
17 
18 namespace kisscpp
19 {
20  //--------------------------------------------------------------------------------
22  {
23  public:
25  RequestHandler("kch-stats", "retrieves the application statistics")
26  {
27  LogStream log(__PRETTY_FUNCTION__);
28  }
29 
31 
32  void run(const BoostPtree &request, BoostPtree &response);
33  protected:
34  private:
35  void gathered(BoostPtree &response);
36  void full (BoostPtree &response);
37  void current (BoostPtree &response);
38  };
39 
40  //--------------------------------------------------------------------------------
42  {
43  public:
45  RequestHandler("kch-errstat", "retrieves the application error states")
46  {
47  LogStream log(__PRETTY_FUNCTION__);
48  }
49 
51 
52  void run(const BoostPtree &request, BoostPtree &response);
53  protected:
54  private:
55  };
56 
57  //--------------------------------------------------------------------------------
59  {
60  public:
62  RequestHandler("kch-errclear", "Used to marks an application error state as cleared.")
63  {
64  LogStream log(__PRETTY_FUNCTION__);
65  }
66 
68 
69  void run(const BoostPtree &request, BoostPtree &response);
70  protected:
71  private:
72  };
73 
74  //--------------------------------------------------------------------------------
76  {
77  public:
79  RequestHandler("kch-handlers", "shows a list of the request handlers for this application"),
80  requestRouter(rr)
81  {
82  LogStream log(__PRETTY_FUNCTION__);
83  }
84 
86 
87  void run(const BoostPtree &request, BoostPtree &response);
88  protected:
89  private:
90  RequestRouter &requestRouter;
91  };
92 
93  //--------------------------------------------------------------------------------
95  {
96  public:
98  RequestHandler("kch-loglevel", "Adjust the log level to specified levels")
99  {
100  LogStream log(__PRETTY_FUNCTION__);
101  }
102 
104 
105  void run(const BoostPtree &request, BoostPtree &response);
106  protected:
107  private:
108  };
109 }
110 
111 #endif // _STANDARD_HANDLERS_HPP_
112 
StatsReporter()
Definition: standard_handlers.hpp:24
void run(const BoostPtree &request, BoostPtree &response)
Definition: standard_handlers.cpp:136
Definition: request_router.hpp:43
~LogLevelAdjuster()
Definition: standard_handlers.hpp:103
Definition: standard_handlers.hpp:94
LogLevelAdjuster()
Definition: standard_handlers.hpp:97
void run(const BoostPtree &request, BoostPtree &response)
Definition: standard_handlers.cpp:167
boost::property_tree::ptree BoostPtree
Definition: boost_ptree.hpp:31
~StatsReporter()
Definition: standard_handlers.hpp:30
Definition: standard_handlers.hpp:41
~ErrorReporter()
Definition: standard_handlers.hpp:50
void run(const BoostPtree &request, BoostPtree &response)
Definition: standard_handlers.cpp:6
Definition: standard_handlers.hpp:58
ErrorCleaner()
Definition: standard_handlers.hpp:61
Definition: logstream.hpp:145
void run(const BoostPtree &request, BoostPtree &response)
Definition: standard_handlers.cpp:67
Definition: standard_handlers.hpp:21
Definition: standard_handlers.hpp:75
ErrorReporter()
Definition: standard_handlers.hpp:44
~ErrorCleaner()
Definition: standard_handlers.hpp:67
HandlerReporter(RequestRouter &rr)
Definition: standard_handlers.hpp:78
Definition: request_handler.hpp:33
void run(const BoostPtree &request, BoostPtree &response)
Definition: standard_handlers.cpp:100
~HandlerReporter()
Definition: standard_handlers.hpp:85