#include <userver/server/handlers/http_handler_flatbuf_base.hpp>
Convenient base for handlers that accept requests with body in Flatbuffer format and respond with body in Flatbuffer format.
Definition at line 41 of file http_handler_flatbuf_base.hpp.
Public Member Functions | |
HttpHandlerFlatbufBase (const components::ComponentConfig &config, const components::ComponentContext &component_context) | |
std::string | HandleRequestThrow (const http::HttpRequest &request, request::RequestContext &context) const final |
virtual ReturnType::NativeTableType | HandleRequestFlatbufThrow (const http::HttpRequest &request, const typename InputType::NativeTableType &input, request::RequestContext &context) const =0 |
const InputType::NativeTableType * | GetInputData (const request::RequestContext &context) const |
const ReturnType::NativeTableType * | GetOutputData (const request::RequestContext &context) const |
Public Member Functions inherited from server::handlers::HttpHandlerBase | |
HttpHandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) | |
void | HandleRequest (request::RequestBase &request, request::RequestContext &context) const override |
void | ReportMalformedRequest (request::RequestBase &request) const final |
virtual const std::string & | HandlerName () const |
const std::vector< http::HttpMethod > & | GetAllowedMethods () const |
virtual logging::Level | GetLogLevelForResponseStatus (http::HttpStatus status) const |
virtual FormattedErrorData | GetFormattedExternalErrorBody (const CustomHandlerException &exc) const |
std::string | GetResponseDataForLoggingChecked (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const |
void | HandleCustomHandlerException (const http::HttpRequest &request, const CustomHandlerException &ex) const |
void | HandleUnknownException (const http::HttpRequest &request, const std::exception &ex) const |
void | LogUnknownException (const std::exception &ex) const |
Helper function to log an unknown exception. | |
const std::optional< logging::Level > & | GetLogLevel () const |
Returns the default log level for the handler. | |
Public Member Functions inherited from server::handlers::HandlerBase | |
HandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) | |
bool | IsMonitor () const |
Returns whether this is a monitoring handler. | |
const HandlerConfig & | GetConfig () const |
Returns handler config. | |
Public Member Functions inherited from components::LoggableComponentBase | |
LoggableComponentBase (const ComponentConfig &, const ComponentContext &) | |
LoggableComponentBase (LoggableComponentBase &&)=delete | |
LoggableComponentBase (const LoggableComponentBase &)=delete | |
~LoggableComponentBase () override=default | |
ComponentHealth | GetComponentHealth () const override |
void | OnLoadingCancelled () override |
void | OnAllComponentsLoaded () override |
void | OnAllComponentsAreStopping () override |
Static Public Member Functions | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from server::handlers::HttpHandlerBase | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from server::handlers::HandlerBase | |
static yaml_config::Schema | GetStaticConfigSchema () |
Static Public Member Functions inherited from components::LoggableComponentBase | |
static yaml_config::Schema | GetStaticConfigSchema () |
Protected Member Functions | |
std::string | GetRequestBodyForLogging (const http::HttpRequest &request, request::RequestContext &context, const std::string &request_body) const override |
Override it if you need a custom request body logging. | |
std::string | GetResponseDataForLogging (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const override |
Override it if you need a custom response data logging. | |
void | ParseRequestData (const http::HttpRequest &request, request::RequestContext &context) const final |
Protected Member Functions inherited from server::handlers::HttpHandlerBase | |
void | ThrowUnsupportedHttpMethod (const http::HttpRequest &request) const |
virtual void | OnRequestCompleteThrow (const http::HttpRequest &, request::RequestContext &) const |
virtual void | HandleStreamRequest (const server::http::HttpRequest &, server::request::RequestContext &, server::http::ResponseBodyStream &) const |
virtual bool | IsStreamed () const |
virtual bool | IsMethodStatisticIncluded () const |
virtual bool | NeedCheckAuth () const |
virtual std::string | GetMetaType (const http::HttpRequest &) const |
Additional Inherited Members | |
Protected Types inherited from server::handlers::HandlerBase | |
using | HandlerErrorCode = handlers::HandlerErrorCode |
using | InternalMessage = handlers::InternalMessage |
using | ExternalBody = handlers::ExternalBody |
using | ClientError = handlers::ClientError |
using | InternalServerError = handlers::InternalServerError |
server::handlers::HttpHandlerFlatbufBase< InputType, ReturnType >::HttpHandlerFlatbufBase | ( | const components::ComponentConfig & | config, |
const components::ComponentContext & | component_context ) |
Definition at line 87 of file http_handler_flatbuf_base.hpp.
const InputType::NativeTableType * server::handlers::HttpHandlerFlatbufBase< InputType, ReturnType >::GetInputData | ( | const request::RequestContext & | context | ) | const |
Definition at line 111 of file http_handler_flatbuf_base.hpp.
const ReturnType::NativeTableType * server::handlers::HttpHandlerFlatbufBase< InputType, ReturnType >::GetOutputData | ( | const request::RequestContext & | context | ) | const |
HandleRequestFlatbufThrow()
or nullptr otherwise. Definition at line 119 of file http_handler_flatbuf_base.hpp.
|
overrideprotectedvirtual |
Override it if you need a custom request body logging.
Reimplemented from server::handlers::HttpHandlerBase.
Definition at line 127 of file http_handler_flatbuf_base.hpp.
|
overrideprotectedvirtual |
Override it if you need a custom response data logging.
Reimplemented from server::handlers::HttpHandlerBase.
Definition at line 136 of file http_handler_flatbuf_base.hpp.
|
static |
Definition at line 163 of file http_handler_flatbuf_base.hpp.
|
finalvirtual |
The core method for HTTP request handling. request
arg contains HTTP headers, full body, etc. The method should return response body.
false
. Reimplemented from server::handlers::HttpHandlerBase.
Definition at line 93 of file http_handler_flatbuf_base.hpp.
|
finalprotectedvirtual |
For internal use. You don't need to override it. This method is overridden in format-specific base handlers.
Reimplemented from server::handlers::HttpHandlerBase.
Definition at line 144 of file http_handler_flatbuf_base.hpp.