summaryrefslogtreecommitdiff
path: root/PlexHTTPRequestHandler.h
blob: 2787e189b679343d2273db4d43de2ea8b0b2962b (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef PLEXHTTPREQUSTHANDLER_H
#define PLEXHTTPREQUSTHANDLER_H

#include <Poco/Net/HTTPRequestHandler.h> // Base class: Poco::Net::HTTPRequestHandler
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
#include <Poco/Net/MessageHeader.h>
#include <Poco/URI.h>
#include <Poco/StringTokenizer.h>

#include <iostream>
#include <sstream>

#include "plex.h"
#include "Config.h"
#include "SubscriptionManager.h"
#include "Plexservice.h"
#include "MediaContainer.h"
#include "Directory.h"
#include "PVideo.h"
#include "Media.h"

#include "plexgdm.h"



namespace plexclient
{

class PlexHTTPRequestHandler : public Poco::Net::HTTPRequestHandler
{
public:
	virtual void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
	
protected:
	std::string GetOKMsg();
	void AddHeaders(Poco::Net::HTTPServerResponse& response, Poco::Net::HTTPServerRequest& request);
	std::map<std::string, std::string> ParseQuery(std::string query);
	void UpdateCommandId(Poco::Net::HTTPServerRequest& request);
};

class SubscribeRequestHandler : public PlexHTTPRequestHandler
{
public:
	virtual void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
	void Subscribe(Poco::Net::HTTPServerRequest& request);
	void Unsubscribe(Poco::Net::HTTPServerRequest& request);
};

class ResourceRequestHandler : public PlexHTTPRequestHandler
{
public:
	virtual void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
};

class PlayerRequestHandler : public PlexHTTPRequestHandler
{
public:
	virtual void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
};


}


#endif // PLEXHTTPREQUSTHANDLER_H