#include <userver/server/handlers/ping.hpp>
Base class for handlers that returns HTTP 200 if the service is OK and able to process requests.
Uses components::State::IsAnyComponentInFatalState() to detect fatal state (can not process requests).
Static options:
Inherits all the options from server::handlers::HttpHandlerBase HTTP Handlers
Definition at line 24 of file ping.hpp.
|
|
void | ThrowUnsupportedHttpMethod (const http::HttpRequest &request) const |
| |
| virtual std::string | HandleRequest (http::HttpRequest &request, request::RequestContext &context) const |
| |
| virtual void | HandleStreamRequest (server::http::HttpRequest &, server::request::RequestContext &, server::http::ResponseBodyStream &) const |
| |
| virtual bool | IsStreamed () const |
| |
| virtual bool | IsStreamed (const http::HttpRequest &, server::request::RequestContext &) const |
| |
| virtual bool | IsMethodStatisticIncluded () const |
| |
| virtual bool | NeedCheckAuth () const |
| |
| virtual std::string | GetRequestBodyForLogging (const http::HttpRequest &request, request::RequestContext &context, const std::string &request_body) const |
| | Override it if you need a custom request body logging.
|
| |
| virtual std::string | GetResponseDataForLogging (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const |
| | Override it if you need a custom response data logging.
|
| |
|
virtual std::string | GetUrlForLogging (const http::HttpRequest &request, request::RequestContext &context) const |
| | Override it if you need a custom request url logging.
|
| |
| virtual void | ParseRequestData (const http::HttpRequest &, request::RequestContext &) const |
| |
|
virtual std::string | GetMetaType (const http::HttpRequest &) const |
| |
◆ ClientError
◆ ExternalBody
◆ HandlerErrorCode
◆ InternalMessage
◆ InternalServerError
◆ LoggableComponentBase
◆ GetComponentHealth()
| ComponentHealth components::ComponentBase::GetComponentHealth |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ GetLogLevelForResponseStatus()
Override it if you need a custom logging level for messages about finish of request handling for some http statuses.
◆ GetRequestBodyForLogging()
|
|
protectedvirtualinherited |
◆ GetResponseDataForLogging()
|
|
protectedvirtualinherited |
◆ HandleCustomHandlerException()
Takes the exception and formats it into response, as specified by exception.
◆ HandleRequest()
|
|
protectedvirtualinherited |
The core method for HTTP request handling. request arg contains HTTP headers, full body, etc. The method should return response body.
- Note
- It is used only if IsStreamed() returned
false.
- Examples
- samples/http_caching/main.cpp.
◆ HandleRequestThrow()
◆ HandleStreamRequest()
|
|
protectedvirtualinherited |
The core method for HTTP request handling. request arg contains HTTP headers, full body, etc. The response body is passed in parts to ResponseBodyStream. Stream transmission is useful when: 1) The body size is unknown beforehand. 2) The client may take advantage of early body transmission (e.g. a Web Browser may start rendering the HTML page or downloading dependant resources). 3) The body size is huge and we want to have only a part of it in memory.
- Note
- It is used only if IsStreamed() returned
true.
◆ HandleUnknownException()
| void server::handlers::HttpHandlerBase::HandleUnknownException |
( |
const http::HttpRequest & | request, |
|
|
const std::exception & | ex ) const |
|
inherited |
Takes the exception and formats it into response as an internal server error.
◆ IsMethodStatisticIncluded()
| virtual bool server::handlers::HttpHandlerBase::IsMethodStatisticIncluded |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
Override it to show per HTTP-method statistics besides statistics for all methods
Definition at line 163 of file http_handler_base.hpp.
◆ IsMonitor()
| bool server::handlers::HandlerBase::IsMonitor |
( |
| ) |
const |
|
inlineinherited |
Returns whether this is a monitoring handler.
Definition at line 67 of file handler_base.hpp.
◆ IsStreamed() [1/2]
| virtual bool server::handlers::HttpHandlerBase::IsStreamed |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
◆ IsStreamed() [2/2]
|
|
inlineprotectedvirtualinherited |
Override it if you need a custom streamed logic based on request and context.
- Note
- The default implementation returns the cached value of "response-body-streamed" value from static config.
Definition at line 159 of file http_handler_base.hpp.
◆ NeedCheckAuth()
| virtual bool server::handlers::HttpHandlerBase::NeedCheckAuth |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
Override it if you want to disable auth checks in handler by some condition
Definition at line 167 of file http_handler_base.hpp.
◆ OnAllComponentsAreStopping()
| void components::ComponentBase::OnAllComponentsAreStopping |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnAllComponentsLoaded()
| void components::ComponentBase::OnAllComponentsLoaded |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnLoadingCancelled()
| void components::ComponentBase::OnLoadingCancelled |
( |
| ) |
|
|
inlineoverridevirtualinherited |
Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.
Reimplemented from components::RawComponentBase.
Definition at line 42 of file component_base.hpp.
◆ ParseRequestData()
|
|
inlineprotectedvirtualinherited |
◆ PrepareAndHandleRequest()
◆ ReportMalformedRequest()
| void server::handlers::HttpHandlerBase::ReportMalformedRequest |
( |
http::HttpRequest & | | ) |
const |
|
finalvirtualinherited |
Produces response to a request unrecognized by the protocol based on provided generic response. Does not throw.
Reimplemented from server::handlers::HandlerBase.
The documentation for this class was generated from the following file: