userver: server::handlers Namespace Reference
Loading...
Searching...
No Matches
server::handlers Namespace Reference

Detailed Description

Most common userver HTTP handlers.

Classes

class  ClientError
 
class  ConflictError
 
class  CustomHandlerException
 The generic base class for handler exceptions. Thrown exceptions should typically derive from ExceptionWithCode instead. More...
 
class  DnsClientControl
 Handlers that controls the DNS client. More...
 
class  DynamicDebugLog
 Handler for forcing specific lines logging. Feature also known as dynamic debug logging. More...
 
class  ExceptionWithCode
 Base class for handler exceptions. For common HandlerErrorCode values you can use more specific exception classes below. For less common HandlerErrorCode values, this class can be used directly. More...
 
struct  ExternalBody
 
struct  ExtraHeaders
 
struct  FormattedErrorData
 
class  HandlerBase
 Base class for the request handlers. More...
 
struct  HandlerConfig
 
struct  HandlerErrorCodeHash
 Hasher class for HandlerErrorCode. More...
 
class  HttpHandlerBase
 Base class for all the Userver HTTP Handlers. More...
 
class  HttpHandlerFlatbufBase
 Convenient base for handlers that accept requests with body in Flatbuffer format and respond with body in Flatbuffer format. More...
 
class  HttpHandlerJsonBase
 Convenient base for handlers that accept requests with body in JSON format and respond with body in JSON format. More...
 
class  HttpHandlerStatic
 Handler that returns HTTP 200 if file exist and returns file data with mapped content/type. More...
 
class  ImplicitOptions
 A "magical" handler that will respond to OPTIONS HTTP method for any other handler that cannot handle OPTIONS itself. More...
 
class  InspectRequests
 Handler that returns information about all in-flight requests. More...
 
struct  InternalMessage
 
class  InternalServerError
 
class  Jemalloc
 Handler that controls the jemalloc allocator. More...
 
class  JsonErrorBuilder
 
class  LegacyJsonErrorBuilder
 
class  LogLevel
 Handler that controls logging levels of all the loggers. More...
 
class  OnLogRotate
 Handler that controls logging levels of all the loggers. More...
 
class  Ping
 Handler that returns HTTP 200 if the service is OK and able to process requests. More...
 
class  RequestParseError
 
class  ResourceNotFound
 
class  ServerMonitor
 Handler that returns statistics data. More...
 
struct  ServiceErrorCode
 
class  TestsControl
 Handler that allows to control the behavior of server from tests, and functional tests with testsuite in particular. More...
 
class  Unauthorized
 

Typedefs

using Headers
 

Enumerations

enum class  HandlerErrorCode {
  kUnknownError ,
  kClientError ,
  kRequestParseError ,
  kUnauthorized ,
  kForbidden ,
  kResourceNotFound ,
  kInvalidUsage ,
  kNotAcceptable ,
  kConflictState ,
  kPayloadTooLarge ,
  kTooManyRequests ,
  kServerSideError ,
  kBadGateway ,
  kGatewayTimeout ,
  kUnsupportedMediaType
}
 
enum class  FallbackHandler { kImplicitOptions }
 
enum class  UrlTrailingSlashOption {
  kBoth ,
  kStrictMatch ,
  kDefault = kBoth
}
 Defines matching behavior for paths with trailing slashes. More...
 

Functions

std::string_view GetCodeDescription (HandlerErrorCode)
 
std::string_view GetFallbackServiceCode (HandlerErrorCode)
 
const std::string & ToString (FallbackHandler)
 
FallbackHandler FallbackHandlerFromString (const std::string &fallback_str)
 
HandlerConfig ParseHandlerConfigsWithDefaults (const yaml_config::YamlConfig &value, const server::ServerConfig &server_config, bool is_monitor=false)
 

Variables

constexpr size_t kFallbackHandlerMax
 

Typedef Documentation

◆ Headers

using server::handlers::Headers
Initial value:
std::unordered_map<std::string, std::string,

Definition at line 78 of file exceptions.hpp.

Enumeration Type Documentation

◆ FallbackHandler

enum class server::handlers::FallbackHandler
strong

Definition at line 9 of file fallback_handlers.hpp.

◆ HandlerErrorCode

Enumeration that defines protocol-agnostic handler error condition codes, used by server::handlers::CustomHandlerException.

Specific error formats can derive various defaults from the this code, e.g. HTTP status code, JSON service error code, and default error message texts.

For example, to provide an HTTP specific error code that is not presented in this enum the HTTP code should be provided via server::http::CustomHandlerException construction with the required server::http::HttpStatus.

Enumerator
kUnknownError 

kUnknownError This value is to map possibly unknown codes to a description, shouldn't be used in client code

kClientError 

kInvalidRequest Invalid request data

kRequestParseError 

kRequestParseError

kUnauthorized 

kUnauthorized Client is not authorised to execute this handler

kForbidden 

kForbidden Requested action is forbidden

kResourceNotFound 

kResourceNoFound Requested resource doesn't exist

kInvalidUsage 

kInvalidUsage Invalid usage of the handler, e.g. unsupported HTTP method

kNotAcceptable 

kNotAcceptable The server cannot produce response, acceptable by the client

kConflictState 

kConflictState Request cannot be completed due to conflict resource state

kPayloadTooLarge 

kPayloadTooLarge The payload for the request exceeded handler's settings

kTooManyRequests 

kTooManyRequests Request limit exceeded

kServerSideError 

kServerSideError An error occurred while processing the request

kBadGateway 

kBadGateway An error occurred while passing the request to another service

kGatewayTimeout 

kGatewayTimeout A timeout occurred while passing the request to another service

kUnsupportedMediaType 

kUnsupportedMediaType Content-Encoding or Content-Type is not supported

Definition at line 30 of file exceptions.hpp.

◆ UrlTrailingSlashOption

Defines matching behavior for paths with trailing slashes.

Enumerator
kBoth 

ignore trailing slashes when matching paths

kStrictMatch 

require exact match for trailing slashes in paths

Definition at line 22 of file handler_config.hpp.

Variable Documentation

◆ kFallbackHandlerMax

constexpr size_t server::handlers::kFallbackHandlerMax
constexpr
Initial value:
=
static_cast<size_t>(FallbackHandler::kImplicitOptions)

Definition at line 13 of file fallback_handlers.hpp.