January 2019
Intermediate to advanced
458 pages
10h 35m
English
The data handler is called whenever no REST API call is recognized by the request handler factory. It tries to find the specified file, read it from disk, and return it, along with the proper HTTP headers. This class is also implemented in its header:
#include <Poco/Net/HTTPRequestHandler.h> #include <Poco/Net/HTTPServerResponse.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/URI.h> #include <Poco/File.h> using namespace Poco::Net; using namespace Poco; class DataHandler: public HTTPRequestHandler { public: void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) { Club::log(LOG_INFO, "DataHandler: Request from " + request.clientAddress().toString()); // Get the path and check for any endpoints ...