stefanfrings::HttpRequestHandler Class Reference

The request handler generates a response for each HTTP request. More...

#include <httprequesthandler.h>

Inheritance diagram for stefanfrings::HttpRequestHandler:
Collaboration diagram for stefanfrings::HttpRequestHandler:

Public Member Functions

 HttpRequestHandler (QObject *parent=nullptr)
 Constructor. More...
virtual ~HttpRequestHandler ()
virtual void service (HttpRequest &request, HttpResponse &response)
 Generate a response for an incoming HTTP request. More...

Detailed Description

The request handler generates a response for each HTTP request.

Web Applications usually have one central request handler that maps incoming requests to several controllers (servlets) based on the requested path.

You need to override the service() method or you will always get an HTTP error 501.

Be aware that the main request handler instance must be created on the heap and that it is used by multiple threads simultaneously.
See also
StaticFileController which delivers static local files.

Definition at line 27 of file httprequesthandler.h.

Constructor & Destructor Documentation

◆ HttpRequestHandler()

HttpRequestHandler::HttpRequestHandler ( QObject *  parent = nullptr)


parentParent object.

Definition at line 10 of file httprequesthandler.cpp.

Member Function Documentation

◆ service()

void HttpRequestHandler::service ( HttpRequest request,
HttpResponse response 

Generate a response for an incoming HTTP request.

requestThe received HTTP request
responseMust be used to return the response
This method must be thread safe

Reimplemented in stefanfrings::StaticFileController.

Definition at line 17 of file httprequesthandler.cpp.

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