Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Protected Member Functions | List of all members
seastar::httpd::handler_base Class Referenceabstract

Detailed Description

handlers holds the logic for serving an incoming request. All handlers inherit from the base handler_base and implement the handle method.

#include <seastar/http/handlers.hh>

Inheritance diagram for seastar::httpd::handler_base:
seastar::httpd::api_registry_base seastar::httpd::file_interaction_handler seastar::httpd::function_handler seastar::httpd::api_registry seastar::httpd::api_registry_20 seastar::httpd::directory_handler seastar::httpd::file_handler

Public Member Functions

virtual future< std::unique_ptr< http::reply > > handle (const sstring &path, std::unique_ptr< http::request > req, std::unique_ptr< http::reply > rep)=0
 
handler_basemandatory (const sstring &param)
 
void verify_mandatory_params (const http::request &req) const
 

Protected Member Functions

 handler_base (const handler_base &)=default
 

Member Function Documentation

◆ handle()

virtual future< std::unique_ptr< http::reply > > seastar::httpd::handler_base::handle ( const sstring &  path,
std::unique_ptr< http::request req,
std::unique_ptr< http::reply rep 
)
pure virtual

All handlers should implement this method. It fill the reply according to the request.

Parameters
paththe url path used in this call
reqthe original request
repthe reply

Implemented in seastar::httpd::api_registry, seastar::httpd::api_registry_20, seastar::httpd::directory_handler, seastar::httpd::file_handler, and seastar::httpd::function_handler.

◆ mandatory()

handler_base & seastar::httpd::handler_base::mandatory ( const sstring &  param)
inline

Add a mandatory parameter

Parameters
parama parameter name
Returns
a reference to the handler

◆ verify_mandatory_params()

void seastar::httpd::handler_base::verify_mandatory_params ( const http::request req) const
inline

Check if all mandatory parameters exist in the request. if any param does not exist, the function would throw a missing_param_exception

Parameters
paramsreq the http request

The documentation for this class was generated from the following file: