summaryrefslogtreecommitdiff
path: root/rotord/rotord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotord.cpp')
-rwxr-xr-x[-rw-r--r--]rotord/rotord.cpp72
1 files changed, 64 insertions, 8 deletions
diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp
index f20b515..c9fbbf5 100644..100755
--- a/rotord/rotord.cpp
+++ b/rotord/rotord.cpp
@@ -73,6 +73,59 @@ void AudioAnalyserHandler::handleRequest(HTTPServerRequest& request,HTTPServerRe
ostr << "</p></body></html>";
}
+RenderContextHandler::RenderContextHandler(const std::vector <std::string> _command): command(_command){
+}
+
+
+void RenderContextHandler::handleRequest(HTTPServerRequest& request,HTTPServerResponse& response) {
+
+ response.setChunkedTransferEncoding(true);
+ response.setContentType("text/html");
+
+ std::ostream& ostr = response.send();
+ string content;
+
+ if (command.size()) {
+ if (command[0]=="new") {
+ Poco:UUID sID=idGen.create();
+ context[sID]=new Rotor::Render_context();
+ context[sID].run();
+ content="<sID>"+sID.toString()+"</sID>";
+ }
+ else {
+ Poco:UUID sID;
+ if (sID.tryParse(command[0]) {
+ iterator iter = context.find(sID);
+ if (iter!=context.end()) {
+ //successfully located context
+ if (command.size()==1) {
+ //just invoking sID
+ if (request.getMethod()=="DELETE") {
+
+ }
+ }
+ else {
+
+ }
+ }
+ else {
+ resp.setStatus(HTTPResponse::HTTP_NOT_FOUND);
+ content="<body>Rotor: render context not found</body>";
+ }
+ }
+ else resp.setStatus(HTTPResponse::HTTP_BAD_REQUEST);
+ content="<body>Rotor: command not found</body>";
+ }
+ }
+ else {
+ content="<body>Rotor: empty request</body>";
+ }
+
+ ostr << "<?xml version="1.0" encoding="ISO-8859-1"?>";
+ ostr << content;
+
+}
+
HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPServerRequest& request){
Application& app = Application::instance();
@@ -90,8 +143,9 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
out+=" ";
}
- app.logger().information("Request from "+ request.clientAddress().toString()+" "+ostr.str()+" segments: "+out);
+ app.logger().information(request.clientAddress().toString()+" "+request.getMethod()+": "+ostr.str()+" segments: "+out);
+ /*
if (segments.size() == 0) {
return new RotorRequestHandler(_format);
}
@@ -107,19 +161,21 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS
return 0;
}
else if (segments[0]=="new") {
- // website creating a new render context
-
+ // create a new render context
- //Settings(string _so="",string _filter="",string _id="",string _input="");
- return new AudioAnalyserHandler(vampHost::Settings(segments[1],segments[2],segments[3]));
- //string audioData=runPlugin(string myname, string soname, string id,
- // string output, int outputNo, string wavname,
- // string outfilename, bool useFrames);
return 0;
}
else {
return 0;
}
+ */
+ return new RenderContextHandler(segments);
+
+ //at this point we are within app
+ //making a new contexthandler?
+ //how will this have access to the thread that it refers to
+ //how will messages be passed
+ //we need to do testing etc here and
}