QtWebApp
httprequesthandler.cpp
Go to the documentation of this file.
1 
6 #include "httprequesthandler.h"
7 
8 using namespace stefanfrings;
9 
11  : QObject(parent)
12 {}
13 
15 {}
16 
18 {
19  qCritical("HttpRequestHandler: you need to override the service() function");
20  qDebug("HttpRequestHandler: request=%s %s %s",request.getMethod().data(),request.getPath().data(),request.getVersion().data());
21  response.setStatus(501,"not implemented");
22  response.write("501 not implemented",true);
23 }
virtual void service(HttpRequest &request, HttpResponse &response)
Generate a response for an incoming HTTP request.
virtual ~HttpRequestHandler()
Destructor.
HttpRequestHandler(QObject *parent=nullptr)
Constructor.
This object represents a single HTTP request.
Definition: httprequest.h:37
QByteArray getPath() const
Get the decoded path of the HTPP request (e.g.
QByteArray getVersion() const
Get the version of the HTPP request (e.g.
QByteArray getMethod() const
Get the method of the HTTP request (e.g.
This object represents a HTTP response, used to return something to the web client.
Definition: httpresponse.h:36
void setStatus(const int statusCode, const QByteArray description=QByteArray())
Set status code and description.
void write(const QByteArray data, const bool lastPart=false)
Write body data to the socket.