-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlexReqHandlerFactory.cpp
33 lines (27 loc) · 1.48 KB
/
PlexReqHandlerFactory.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}
else {
std::cout << "??? Request: " << request.getURI() << " from: " << request.clientAddress().toString() << std::endl;
}
*/
if (request.getURI().find("/player/timeline") != std::string::npos) return new SubscribeRequestHandler();
else if (request.getURI().find("/player/mirror") != std::string::npos) return new MirrorRequestHandler();
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();
}
}