Hobrasoft httpd server
Embedded HTTP server for Qt and C++
httprequesthandler.cpp
Go to the documentation of this file.
1 
8 #include "httprequesthandler.h"
9 #include "httprequest.h"
10 #include "httpresponse.h"
11 #include "httpconnection.h"
12 #include "staticfilecontroller.h"
13 #include "shtmlcontroller.h"
14 
15 using namespace HobrasoftHttpd;
16 
17 
19  m_connection = parent;
20 }
21 
22 
24  QString path = request->path();
25  m_connection->setObjectName(path);
26 
27  if (path.endsWith(".shtml")) {
28  ShtmlController(m_connection).service(request,response);
29  return;
30  }
31 
32  StaticFileController(m_connection).service(request, response);
33 }
34 
35 
37  return m_connection->response();
38 }
39 
40 
41 
43  return connection()->settings();
44 }
const HttpSettings * settings() const
Returns pointer to settings used in the class.
void service(HttpRequest *request, HttpResponse *response)
Processes one request.
HttpResponse * response()
Returns new instance of HttpResponse class.
QString path() const
Returns path of the request (/files/index.html)
Definition: httprequest.h:78
HttpConnection * connection() const
Returns pointer to parent HttpConnection class.
virtual void service(HttpRequest *request, HttpResponse *response)
Request processing. Should be reimplemented in derived class.
Response to HTTP request - headers, cookies and body.
Definition: httpresponse.h:30
void service(HttpRequest *request, HttpResponse *response)
Processes the request.
Configuration of the http server instance.
Definition: httpsettings.h:39
const HttpSettings * settings() const
Returns pointer to HttpSettings used in the HttpServer.
HttpRequestHandler(HttpConnection *parent)
Konstruktor.
Processes request to SHTML files.
Processes HTTP request, parses headers, body and files sent by HTTP protocol.
Definition: httprequest.h:23
Processes request for static files.
Namespace of HTTP server.
One single connection to http server.