request handler?

This commit is contained in:
Jonas Zeunert
2019-04-15 13:52:53 +02:00
parent 865772214b
commit 4c7b490300

View File

@@ -4,6 +4,8 @@
#include "OutputRequestHandler.h" #include "OutputRequestHandler.h"
#include <Poco/Net/HTTPServerResponse.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/URI.h> #include <Poco/URI.h>
#include <Poco/Exception.h> #include <Poco/Exception.h>
namespace flippR_driver namespace flippR_driver
@@ -20,13 +22,14 @@ OutputRequestHandler::OutputRequestHandler(std::shared_ptr<output::OutputDriver>
void OutputRequestHandler::handleRequest(HTTPServerRequest &request, void OutputRequestHandler::handleRequest(HTTPServerRequest &request,
HTTPServerResponse &response) HTTPServerResponse &response)
{ {
auto& path_segments = getPathSegments(URI(request.getPathSegments())); auto& path_segments = getPathSegments(URI(request.getURI()));
std::string item_type = path_segments.at(0); std::string item_type = path_segments.at(0);
std::string item_name = path_segments.at(1); std::string item_name = path_segments.at(1);
std::string action = path_segments.at(2); std::string action = path_segments.at(2);
std::string score = ""; std::string score = "";
request.
if(item_type == "displays") if(item_type == "displays")
{ {
score = path_segments.at(3); score = path_segments.at(3);
@@ -155,6 +158,7 @@ void OutputRequestHandler::parseDisplay(const std::string& item_name, const std:
throw new Poco::NotFoundException("No Action with name \"" + action + "\" on sounds!"); throw new Poco::NotFoundException("No Action with name \"" + action + "\" on sounds!");
} }
} }
std::vector<std::string> OutputRequestHandler::getPathSegements(Poco::URI uri) std::vector<std::string> OutputRequestHandler::getPathSegements(Poco::URI uri)
{ {
std::vector<std::string> path_segments; std::vector<std::string> path_segments;