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