tufao  1.3.0
An asynchronous web framework for C++ built on top of Qt
Tufao::AbstractHttpServerRequestHandler Class Referenceabstract

This class provides an interface for HttpServerRequest handlers. More...

+ Inheritance diagram for Tufao::AbstractHttpServerRequestHandler:
+ Collaboration diagram for Tufao::AbstractHttpServerRequestHandler:

Public Member Functions

 operator std::function< bool (HttpServerRequest &, HttpServerResponse &)>()
 Implicit conversion operator to std::function functor object. More...
 
virtual bool handleRequest (Tufao::HttpServerRequest &request, Tufao::HttpServerResponse &response)=0
 Handles the request using the response object. More...
 

Detailed Description

This class provides an interface for HttpServerRequest handlers.

A request handler is usually registered to handle requests matching some set of rules and usually used with a set of other handlers.

A sample request handler is given below:

bool RequestHandler::handleRequest(Tufao::HttpServerRequest &request,
{
response.writeHead(HttpResponseStatus::OK);
response.end("Hello World\n");
return true;
}
See also
HttpServerRequestRouter
Since
0.3

Member Function Documentation

virtual bool Tufao::AbstractHttpServerRequestHandler::handleRequest ( Tufao::HttpServerRequest request,
Tufao::HttpServerResponse response 
)
pure virtual

Handles the request using the response object.

Return values
trueIf the handler has responded to the request.
falseIf the requested page can't be generated by this handler. The connection should remain open and the response object shouldn't be used, leaving the response free to be used by other handlers in the chain.
Since
1.0
Tufao::AbstractHttpServerRequestHandler::operator std::function< bool ( HttpServerRequest ,
HttpServerResponse  
)
inline

Implicit conversion operator to std::function functor object.

Warning
You shall not use the returned object after the AbstractHttpServerRequest object is destroyed.
Since
1.0

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