Skip to Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

HTTP request handler

Whenever POCO's HTTP server receives a new client connection, it uses a new instance of our RequestHandlerFactory class to get a handler for the specific request. Because it's such a simple class, it's fully implemented in the header:

#include <Poco/Net/HTTPRequestHandlerFactory.h> #include <Poco/Net/HTTPServerRequest.h> using namespace Poco::Net; #include "statushandler.h" #include "datahandler.h" class RequestHandlerFactory: public HTTPRequestHandlerFactory {  public:          RequestHandlerFactory() {}          HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) {                if (request.getURI().compare(0, 12, "/clubstatus/") == 0) { 
                     return new StatusHandler(); 
               }                else { return new DataHandler(); }          } };

Our class doesn't ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers

Hands-On RTOS with Microcontrollers

Brian Amos

Publisher Resources

ISBN: 9781788629300Supplemental Content