identt
NotFoundService.hpp
1 
33 #ifndef _IDENTT_QUERY_NOTFOUNDSERVICE_HPP_
34 #define _IDENTT_QUERY_NOTFOUNDSERVICE_HPP_
35 
36 #include <query/ServiceBase.hpp>
37 
38 namespace identt {
39 namespace query {
40 
41 template <class HttpServerT>
42 class NotFoundService : protected identt::query::ServiceBase<HttpServerT> {
43 public:
44 
61  NotFoundService(identt::utils::SharedTable::pointer stptr,
62  typename std::shared_ptr<HttpServerT> server,
63  unsigned int scope)
64  : identt::query::ServiceBase<HttpServerT>(IDENTT_SERVICE_SCOPE_HTTP | IDENTT_SERVICE_SCOPE_HTTPS)
65  {
66  if (!(this->myscope & scope)) return; // scope mismatch
67  server->default_resource["GET"] =
68  [this](typename HttpServerT::RespPtr response, typename HttpServerT::ReqPtr request) {
69  this->HttpErrorAction(response,request,404,"NOT FOUND");
70  };
71  server->default_resource["POST"] =
72  [this](typename HttpServerT::RespPtr response, typename HttpServerT::ReqPtr request) {
73  this->HttpErrorAction(response,request,404,"NOT FOUND");
74  };
75  }
76 
77 private:
78 };
79 
80 } // namespace query
81 } // namespace identt
82 
83 #endif // _IDENTT_QUERY_NOTFOUNDSERVICE_HPP_
NotFoundService(identt::utils::SharedTable::pointer stptr, typename std::shared_ptr< HttpServerT > server, unsigned int scope)
NotFoundService : constructor.
Definition: NotFoundService.hpp:61
void HttpErrorAction(typename HttpServerT::RespPtr response, typename HttpServerT::ReqPtr request, int ec, const char *em)
HttpErrorAction : Error Action Template no payload maybe template.
Definition: ServiceBase.hpp:85
Definition: ServiceBase.hpp:55
Definition: CryptoBase.hpp:49
Definition: NotFoundService.hpp:42