From 1de09c4f69fed0d4adc3d8c1ed19473db4a342b0 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 25 Apr 2013 13:33:05 +0100 Subject: GET styles --- rotord/rotord.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'rotord/rotord.cpp') diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp index a919a0b..1a68638 100755 --- a/rotord/rotord.cpp +++ b/rotord/rotord.cpp @@ -169,23 +169,23 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS //eventually retrieve from sql; //a bit of weirdness here: prefer to just get whole file to a string. if (request.getMethod()=="GET") { - std::vector styles = {"style01.xml","style02.xml" }; //c++11 STL initialiser list - content+="\n"; - for (auto &style: styles) { - Poco::File f=Poco::File(style); + std::string stylesfile = "styles.xml"; + Poco::File f=Poco::File(stylesfile); if (f.exists()) { - Poco::FileInputStream file(style); - string s=""; - while (!file.eof()) { - content +=s; - file >> s; - content +=" "; - } - content +="\n"; + Poco::FileInputStream file(stylesfile); + //while (!file.eof()) { + // file >> content; + //} + Poco::StreamCopier::copyToString(file, content); + status=HTTPResponse::HTTP_OK; } - } - content+="\n"; - status=HTTPResponse::HTTP_OK; + else { + content="Rotor: internal error: styles not found\n"; + } + + } + else { + content="Rotor: bad request\n"; } } else { -- cgit v1.2.3