userver: HTTP Handlers
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
HTTP Handlers

Detailed Description

Handlers are components that could be used by components::Server to process the incoming requests.

All the HTTP handlers derive from server::handlers::HttpHandlerBase and override its methods to provide functionality.

See Userver Components for more information on how to register components.

Configuration

All the handlers inherit configuration options from their base classes:

All the components, including handlers, also have the load-enabled option.

Static configuration example:

Here's an example of the full config for the server::handlers::Ping handle.

    handler-ping:
        # Options from server::handlers::HandlerBase
        path: /ping
        method: GET
        task_processor: main-task-processor
        max_request_size: 256
        max_headers_size: 256
        parse_args_from_body: false
        # auth: TODO:
        url_trailing_slash: strict-match
        max_requests_in_flight: 100
        request_body_size_log_limit: 128
        response_data_size_log_limit: 128
        max_requests_per_second: 100
        decompress_request: false
        throttling_enabled: false
        set-response-server-hostname: false
 
        # Options from server::handlers::HttpHandlerBase
        log-level: WARNING
 
        # Common component options
        load-enabled: true

+ Collaboration diagram for HTTP Handlers:

Classes

class  alerts::Handler
 Handler that returns the list of active fired alerts. More...
 
class  server::handlers::DnsClientControl
 Handlers that controls the DNS client. More...
 
class  server::handlers::DynamicDebugLog
 Handler for forcing specific lines logging. Feature also known as dynamic debug logging. More...
 
class  server::handlers::HttpHandlerBase
 Base class for all the Userver HTTP Handlers. More...
 
class  server::handlers::HttpHandlerFlatbufBase< InputType, ReturnType >
 Convenient base for handlers that accept requests with body in Flatbuffer format and respond with body in Flatbuffer format. More...
 
class  server::handlers::HttpHandlerJsonBase
 Convenient base for handlers that accept requests with body in JSON format and respond with body in JSON format. More...
 
class  server::handlers::HttpHandlerStatic
 Handler that returns HTTP 200 if file exist and returns file data with mapped content/type. More...
 
class  server::handlers::ImplicitOptions
 A "magical" handler that will respond to OPTIONS HTTP method for any other handler that cannot handle OPTIONS itself. More...
 
class  server::handlers::InspectRequests
 Handler that returns information about all in-flight requests. More...
 
class  server::handlers::Jemalloc
 Handler that controls the jemalloc allocator. More...
 
class  server::handlers::LogLevel
 Handler that controls logging levels of all the loggers. More...
 
class  server::handlers::OnLogRotate
 Handler that controls logging levels of all the loggers. More...
 
class  server::handlers::Ping
 Handler that returns HTTP 200 if the service is OK and able to process requests. More...
 
class  server::handlers::ServerMonitor
 Handler that returns statistics data. More...
 
class  server::handlers::TestsControl
 Handler that allows to control the behavior of server from tests, and functional tests with testsuite in particular. More...
 
class  server::websocket::WebsocketHandlerBase
 Base class for WebSocket handler. More...