|
|
@ -64,6 +64,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|
|
|
IXmlSerializer xmlSerializer,
|
|
|
|
IXmlSerializer xmlSerializer,
|
|
|
|
IHttpListener socketListener,
|
|
|
|
IHttpListener socketListener,
|
|
|
|
ILocalizationManager localizationManager,
|
|
|
|
ILocalizationManager localizationManager,
|
|
|
|
|
|
|
|
ServiceController serviceController,
|
|
|
|
IHostEnvironment hostEnvironment)
|
|
|
|
IHostEnvironment hostEnvironment)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_appHost = applicationHost;
|
|
|
|
_appHost = applicationHost;
|
|
|
@ -75,6 +76,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;
|
|
|
|
_hostEnvironment = hostEnvironment;
|
|
|
|
_hostEnvironment = hostEnvironment;
|
|
|
|
|
|
|
|
|
|
|
@ -95,7 +98,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)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -602,17 +605,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>[]
|
|
|
|
{
|
|
|
|
{
|
|
|
|