Hobrasoft httpd server
Embedded HTTP server for Qt and C++
|
Processes incoming requests. More...
#include <httprequesthandler.h>
Public Member Functions | |
HttpRequestHandler (HttpConnection *parent) | |
Konstruktor. | |
virtual void | service (HttpRequest *request, HttpResponse *response) |
Request processing. Should be reimplemented in derived class. More... | |
HttpResponse * | response () |
Returns new instance of HttpResponse class. More... | |
Protected Member Functions | |
HttpConnection * | connection () const |
Returns pointer to parent HttpConnection class. | |
const HttpSettings * | settings () const |
Returns pointer to HttpSettings used in the HttpServer. | |
Processes incoming requests.
When building your own http server, you should reimplement this class.
You need to reimplement the service() method, for example:
Controller classes in the example are derived from HttpRequstHandler, too.
When implementing event streams you should make a slot to receive information about changed status. Create new HttpResponse in the slot and write your data to it:
If you want to use simplier way to make your own event streams, use the class AbstractController from example. AbstractController class implements simple json API to get/put/delete objects, lists, event streams.
Definition at line 81 of file httprequesthandler.h.
HttpResponse * HttpRequestHandler::response | ( | ) |
Returns new instance of HttpResponse class.
The instance is connected with opened socket. Method is used in derived classes in specialized handlers used to handle text/event-stream requests. In such case one request invokes multiple responses. Each response should be created calling this method.
Volá HttpConnection::response().
Definition at line 36 of file httprequesthandler.cpp.
|
virtual |
Request processing. Should be reimplemented in derived class.
This method should be reimplemeted in derived class. Default implementations can handle static content and shtml files only.
Reimplemented in Example::Httpd::AbstractController, Example::Httpd::RequestMapper, HobrasoftHttpd::StaticFileController, and HobrasoftHttpd::ShtmlController.
Definition at line 23 of file httprequesthandler.cpp.