diff options
author | chriszero <zerov83@gmail.com> | 2014-11-15 19:43:07 +0100 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2014-11-15 19:43:07 +0100 |
commit | 23f9f7712bfa33b5a488a447a6fabe6035cc3240 (patch) | |
tree | 06bbe8e0bc52496c5ad3c41accc7524aa597e670 /PlexReqHandlerFactory.cpp | |
parent | a40adaf76fb1267d38b4c5e6386933ddb2d0d328 (diff) | |
download | vdr-plugin-plex-23f9f7712bfa33b5a488a447a6fabe6035cc3240.tar.gz vdr-plugin-plex-23f9f7712bfa33b5a488a447a6fabe6035cc3240.tar.bz2 |
initial commit
Diffstat (limited to 'PlexReqHandlerFactory.cpp')
-rw-r--r-- | PlexReqHandlerFactory.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/PlexReqHandlerFactory.cpp b/PlexReqHandlerFactory.cpp new file mode 100644 index 0000000..1b68bcb --- /dev/null +++ b/PlexReqHandlerFactory.cpp @@ -0,0 +1,33 @@ +#include "PlexReqHandlerFactory.h" + +namespace plexclient +{ + +PlexReqHandlerFactory::PlexReqHandlerFactory() +{ +} + +PlexReqHandlerFactory::~PlexReqHandlerFactory() +{ +} + +Poco::Net::HTTPRequestHandler* PlexReqHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest& request) +{ + if(request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET) { + std::cout << "GET Request: " << request.getURI() << " from: " << request.clientAddress().toString() << std::endl; + } + else if(request.getMethod() == Poco::Net::HTTPRequest::HTTP_OPTIONS) { + std::cout << "OPTIONS Request: " << request.getURI() << " from: " << request.clientAddress().toString() << std::endl; + } + else if(request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD) { + std::cout << "HEAD Request: " << request.getURI() << " from: " << request.clientAddress().toString() << std::endl; + } + + if(request.getURI().find("/subscribe")!= std::string::npos) return new SubscribeRequestHandler(); + else if(request.getURI().find("/resources")!= std::string::npos) return new ResourceRequestHandler(); + else if(request.getURI().find("/player")!= std::string::npos) return new PlayerRequestHandler(); + + return new PlexHTTPRequestHandler(); +} + +} |