#include <userver/server/handlers/ping.hpp>
Handler 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 and adds the following ones:
Name | Description | Default value |
warmup-time-secs | how much time it needs to warmup the server | 0 |
- Examples
- samples/production_service/production_service.cpp.
Definition at line 29 of file ping.hpp.
◆ 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 |
◆ 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 156 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()
virtual bool server::handlers::HttpHandlerBase::IsStreamed |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
◆ 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 160 of file http_handler_base.hpp.
◆ OnAllComponentsAreStopping()
void components::ComponentBase::OnAllComponentsAreStopping |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnAllComponentsLoaded()
void server::handlers::Ping::OnAllComponentsLoaded |
( |
| ) |
|
|
overridevirtual |
Component may use this function to finalize registration of other components that depend on it (for example, handler components register in server component, and the latter uses OnAllComponentsLoaded() to start processing requests).
Base components may override it and make final
to do some work after the derived object constructor is called. Don't use it otherwise.
Reimplemented from components::ComponentBase.
◆ 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: