|
|
@ -60,7 +60,8 @@ namespace Emby.Server.Implementations.HttpServer
|
|
|
|
IJsonSerializer jsonSerializer,
|
|
|
|
IJsonSerializer jsonSerializer,
|
|
|
|
IXmlSerializer xmlSerializer,
|
|
|
|
IXmlSerializer xmlSerializer,
|
|
|
|
IHttpListener socketListener,
|
|
|
|
IHttpListener socketListener,
|
|
|
|
ILocalizationManager localizationManager)
|
|
|
|
ILocalizationManager localizationManager,
|
|
|
|
|
|
|
|
ServiceController serviceController)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_appHost = applicationHost;
|
|
|
|
_appHost = applicationHost;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
@ -71,6 +72,8 @@ namespace Emby.Server.Implementations.HttpServer
|
|
|
|
_jsonSerializer = jsonSerializer;
|
|
|
|
_jsonSerializer = jsonSerializer;
|
|
|
|
_xmlSerializer = xmlSerializer;
|
|
|
|
_xmlSerializer = xmlSerializer;
|
|
|
|
_socketListener = socketListener;
|
|
|
|
_socketListener = socketListener;
|
|
|
|
|
|
|
|
ServiceController = serviceController;
|
|
|
|
|
|
|
|
|
|
|
|
_socketListener.WebSocketConnected = OnWebSocketConnected;
|
|
|
|
_socketListener.WebSocketConnected = OnWebSocketConnected;
|
|
|
|
|
|
|
|
|
|
|
|
_funcParseFn = t => s => JsvReader.GetParseFn(t)(s);
|
|
|
|
_funcParseFn = t => s => JsvReader.GetParseFn(t)(s);
|
|
|
@ -90,7 +93,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|
|
|
|
|
|
|
|
|
|
|
public string GlobalResponse { get; set; }
|
|
|
|
public string GlobalResponse { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public ServiceController ServiceController { get; private set; }
|
|
|
|
public ServiceController ServiceController { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public object CreateInstance(Type type)
|
|
|
|
public object CreateInstance(Type type)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -594,17 +597,15 @@ namespace Emby.Server.Implementations.HttpServer
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Adds the rest handlers.
|
|
|
|
/// Adds the rest handlers.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="services">The services.</param>
|
|
|
|
/// <param name="serviceTypes">The service types to register with the <see cref="ServiceController"/>.</param>
|
|
|
|
/// <param name="listeners"></param>
|
|
|
|
/// <param name="listeners">The web socket listeners.</param>
|
|
|
|
/// <param name="urlPrefixes"></param>
|
|
|
|
/// <param name="urlPrefixes">The URL prefixes. See <see cref="UrlPrefixes"/>.</param>
|
|
|
|
public void Init(IEnumerable<IService> services, IEnumerable<IWebSocketListener> listeners, IEnumerable<string> urlPrefixes)
|
|
|
|
public void Init(IEnumerable<Type> serviceTypes, IEnumerable<IWebSocketListener> listeners, IEnumerable<string> urlPrefixes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_webSocketListeners = listeners.ToArray();
|
|
|
|
_webSocketListeners = listeners.ToArray();
|
|
|
|
UrlPrefixes = urlPrefixes.ToArray();
|
|
|
|
UrlPrefixes = urlPrefixes.ToArray();
|
|
|
|
ServiceController = new ServiceController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var types = services.Select(r => r.GetType());
|
|
|
|
ServiceController.Init(this, serviceTypes);
|
|
|
|
ServiceController.Init(this, types);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResponseFilters = new Action<IRequest, HttpResponse, object>[]
|
|
|
|
ResponseFilters = new Action<IRequest, HttpResponse, object>[]
|
|
|
|
{
|
|
|
|
{
|
|
|
|