userver: userver/server/handlers/handler_base.hpp Source File
Loading...
Searching...
No Matches
handler_base.hpp
Go to the documentation of this file.
1#pragma once
2
5
11
12USERVER_NAMESPACE_BEGIN
13
14namespace server::handlers {
15
25class HandlerBase : public components::ComponentBase {
26public:
27 HandlerBase(
28 const components::ComponentConfig& config,
29 const components::ComponentContext& component_context,
30 bool is_monitor = false
31 );
32 ~HandlerBase() noexcept override = default;
33
37
42
44 bool IsMonitor() const { return is_monitor_; }
45
47 const HandlerConfig& GetConfig() const;
48
50
51protected:
52 // Pull the type names in the handler's scope to shorten throwing code
53 using HandlerErrorCode = handlers::HandlerErrorCode;
54 using InternalMessage = handlers::InternalMessage;
55 using ExternalBody = handlers::ExternalBody;
56
57 using ClientError = handlers::ClientError;
58 using InternalServerError = handlers::InternalServerError;
59
60private:
61 bool is_monitor_;
62 HandlerConfig config_;
63};
64
65} // namespace server::handlers
66
67USERVER_NAMESPACE_END