diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-04-25 13:33:05 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-04-25 13:33:05 +0100 |
| commit | 1de09c4f69fed0d4adc3d8c1ed19473db4a342b0 (patch) | |
| tree | 4c0b04608ec72307b68e08aa6d4f84a2f5cf041d /rotord/rotord.cpp | |
| parent | 740768a0d6b13ecc3eb68219f6eee208ab4ecc1d (diff) | |
GET styles
Diffstat (limited to 'rotord/rotord.cpp')
| -rwxr-xr-x | rotord/rotord.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
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<std::string> styles = {"style01.xml","style02.xml" }; //c++11 STL initialiser list - content+="<styles>\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+="</styles>\n"; - status=HTTPResponse::HTTP_OK; + else { + content="<status>Rotor: internal error: styles not found</status>\n"; + } + + } + else { + content="<status>Rotor: bad request</status>\n"; } } else { |
