C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::detail::http_route_base< Ts > Class Template Referenceabstract

Base type for HTTP routes that parse one or more arguments from the requests and then forward them to a user-provided function object. More...

#include <route.hpp>

Inheritance diagram for caf::detail::http_route_base< Ts >:
caf::net::http::route caf::ref_counted caf::detail::atomic_ref_counted

Public Member Functions

 http_route_base (std::string &&path, std::optional< net::http::method > method)
 
bool exec (const net::http::request_header &hdr, const_byte_span body, net::http::router *parent) override
 Tries to match an HTTP request and processes the request on a match.
 
template<size_t... Is>
bool exec_dis (const net::http::request_header &hdr, const_byte_span body, net::http::router *parent, std::index_sequence< Is... >, std::string_view *arr)
 
template<class... Is>
bool exec_impl (const net::http::request_header &hdr, const_byte_span body, net::http::router *parent, std::optional< Ts > &&... args)
 
- Public Member Functions inherited from caf::net::http::route
virtual void init ()
 Called by the HTTP server when starting up.
 
- Public Member Functions inherited from caf::detail::atomic_ref_counted
 atomic_ref_counted (const atomic_ref_counted &)
 
atomic_ref_countedoperator= (const atomic_ref_counted &)
 
void ref () const noexcept
 Increases reference count by one.
 
void deref () const noexcept
 Decreases reference count by one and calls request_deletion when it drops to zero.
 
bool unique () const noexcept
 Queries whether there is exactly one reference.
 
size_t get_reference_count () const noexcept
 Queries the current reference count for this object.
 

Additional Inherited Members

- Public Types inherited from caf::ref_counted
using super = detail::atomic_ref_counted
 
- Protected Attributes inherited from caf::detail::atomic_ref_counted
std::atomic< size_t > rc_
 

Detailed Description

template<class... Ts>
class caf::detail::http_route_base< Ts >

Base type for HTTP routes that parse one or more arguments from the requests and then forward them to a user-provided function object.

Member Function Documentation

◆ exec()

template<class... Ts>
bool caf::detail::http_route_base< Ts >::exec ( const net::http::request_header & hdr,
const_byte_span body,
net::http::router * parent )
overridevirtual

Tries to match an HTTP request and processes the request on a match.

The route may send errors to the client or call shutdown on the parent for severe errors.

Parameters
hdrThe HTTP request header from the client.
bodyThe payload from the client.
parentPointer to the object that uses this route.
Returns
true if the route matches the request, false otherwise.

Implements caf::net::http::route.


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