NAWA 0.9
Web Application Framework for C++
nawa::HttpRequestHandler Class Reference

#include </github/workspace/internal/nawa/RequestHandler/impl/HttpRequestHandler.h>

Inherits nawa::RequestHandler.

Public Member Functions

 HttpRequestHandler (std::shared_ptr< HandleRequestFunctionWrapper > handleRequestFunction, Config config, int concurrency)
 
 ~HttpRequestHandler () override
 
void start () override
 
void stop () noexcept override
 
void terminate () noexcept override
 
void join () noexcept override
 
- Public Member Functions inherited from nawa::RequestHandler
virtual ~RequestHandler ()
 
void setAppRequestHandler (std::shared_ptr< HandleRequestFunctionWrapper > handleRequestFunction) noexcept
 
void setAccessFilters (AccessFilterList accessFilters) noexcept
 
std::shared_ptr< Config const > getConfig () const noexcept
 
void setConfig (Config config) noexcept
 
void reconfigure (std::optional< std::shared_ptr< HandleRequestFunctionWrapper > > handleRequestFunction, std::optional< AccessFilterList > accessFilters, std::optional< Config > config) noexcept
 
void reconfigure (HandleRequestFunction handleRequestFunction, std::optional< AccessFilterList > accessFilters, std::optional< Config > config) noexcept
 
virtual void restart () noexcept
 
void handleRequest (Connection &connection)
 

Additional Inherited Members

- Static Public Member Functions inherited from nawa::RequestHandler
static std::unique_ptr< RequestHandlernewRequestHandler (std::shared_ptr< HandleRequestFunctionWrapper > const &handleRequestFunction, Config config, int concurrency)
 
static std::unique_ptr< RequestHandlernewRequestHandler (HandleRequestFunction handleRequestFunction, Config config, int concurrency)
 
- Protected Member Functions inherited from nawa::RequestHandler
 RequestHandler ()
 

Detailed Description

Definition at line 30 of file HttpRequestHandler.h.

Constructor & Destructor Documentation

◆ HttpRequestHandler()

HttpRequestHandler::HttpRequestHandler ( std::shared_ptr< HandleRequestFunctionWrapper handleRequestFunction,
Config  config,
int  concurrency 
)

Construct a FastcgiRequestHandler object. May throw a nawa::Exception on failure.

Parameters
handleRequestFunctionThe handleRequest function of the app.
configThe config.
concurrencyConcurrency level (number of worker threads).

Definition at line 252 of file HttpRequestHandler.cpp.

◆ ~HttpRequestHandler()

HttpRequestHandler::~HttpRequestHandler ( )
override

Definition at line 286 of file HttpRequestHandler.cpp.

Member Function Documentation

◆ start()

void HttpRequestHandler::start ( )
overridevirtual

Start request handling. Must not block and return immediately if request handling is already running. May throw a nawa::Exception on failure during startup, but ideally, all actions which could lead to errors (or preliminary checks to avoid errors) should be done in the constructor, to avoid unnecessary initialization steps. Behavior of calling this function after join() has already been called is undefined, ideally, it should throw a nawa::Exception (proposed error code: 10). Please not that request handlers currently do NOT have to support restarting (i.e., calling stop, then start). The default FastCGI and HTTP request handlers do not support this and will not start request handling once again after stopping.

Implements nawa::RequestHandler.

Definition at line 298 of file HttpRequestHandler.cpp.

◆ stop()

void HttpRequestHandler::stop ( )
overridevirtualnoexcept

Stop request handling after current requests have been served. Must not block and return immediately after the shutdown has been initiated. Must do nothing if request handling has already stopped or even joined.

Implements nawa::RequestHandler.

Definition at line 321 of file HttpRequestHandler.cpp.

◆ terminate()

void HttpRequestHandler::terminate ( )
overridevirtualnoexcept

Enforce termination of request handling. Must not block and return immediately after the termination of request handling has been initiated (nevertheless, the termination should only take a few milliseconds after this function has been called). Must do nothing if request handling has already stopped or even joined.

Implements nawa::RequestHandler.

Definition at line 330 of file HttpRequestHandler.cpp.

◆ join()

void HttpRequestHandler::join ( )
overridevirtualnoexcept

Block until request handling has terminated. This is the only function that should block. If join has already been called, this function must return immediately, without throwing exceptions. By joining, the RequestHandler object becomes defunct and cannot be reused afterwards.

Implements nawa::RequestHandler.

Definition at line 339 of file HttpRequestHandler.cpp.


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