userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
handler_base.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/components/component_base.hpp
>
7
#include <
userver/server/handlers/exceptions.hpp
>
8
#include <
userver/server/handlers/handler_config.hpp
>
9
#include <
userver/server/http/http_request.hpp
>
10
#include <
userver/server/request/request_context.hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
server::handlers
{
15
25
class
HandlerBase :
public
components::ComponentBase
{
26
public
:
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
36
virtual
void
PrepareAndHandleRequest
(
http::HttpRequest
&
request
,
request::RequestContext
& context)
const
= 0;
37
41
virtual
void
ReportMalformedRequest
(
http::HttpRequest
&)
const
{}
42
44
bool
IsMonitor
()
const
{
return
is_monitor_; }
45
47
const
HandlerConfig
&
GetConfig
()
const
;
48
49
static
yaml_config::Schema
GetStaticConfigSchema
();
50
51
protected
:
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
60
private
:
61
bool
is_monitor_;
62
HandlerConfig
config_;
63
};
64
65
}
// namespace server::handlers
66
67
USERVER_NAMESPACE_END
userver
server
handlers
handler_base.hpp
Generated on
for userver by
Doxygen
1.17.0