Files
GoldenCheetah/httpserver/httprequesthandler.h
Mark Liversedge 30d488ce72 Add httpserver to contrib
.. see http://stefanfrings.de/qtwebapp/index-en.html

.. this is a lightweight web server to allow GC to
   provide webservices.

.. we will be providing web services on localhost to
   enable R integration.

.. we will use web services to standardise the
   interface to provide something we can use in R
   but also anything else at a later date.

.. gcconfig.pri contains $$HTPATH that points to
   the location of the code, if it is not set then
   the web server is not compiled in.
2015-09-05 20:40:38 +01:00

50 lines
1.3 KiB
C++

/**
@file
@author Stefan Frings
*/
#ifndef HTTPREQUESTHANDLER_H
#define HTTPREQUESTHANDLER_H
#include "httpglobal.h"
#include "httprequest.h"
#include "httpresponse.h"
/**
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.
<p>
You need to override the service() method or you will always get an HTTP error 501.
<p>
@warning Be aware that the main request handler instance must be created on the heap and
that it is used by multiple threads simultaneously.
@see StaticFileController which delivers static local files.
*/
class DECLSPEC HttpRequestHandler : public QObject {
Q_OBJECT
Q_DISABLE_COPY(HttpRequestHandler)
public:
/**
* Constructor.
* @param parent Parent object.
*/
HttpRequestHandler(QObject* parent=NULL);
/** Destructor */
virtual ~HttpRequestHandler();
/**
Generate a response for an incoming HTTP request.
@param request The received HTTP request
@param response Must be used to return the response
@warning This method must be thread safe
*/
virtual void service(HttpRequest& request, HttpResponse& response);
};
#endif // HTTPREQUESTHANDLER_H