2
0
LukePulverenti 12 жил өмнө
parent
commit
332f635939

+ 1 - 0
MediaBrowser.Common/MediaBrowser.Common.csproj

@@ -61,6 +61,7 @@
     <Compile Include="IO\StreamDefaults.cs" />
     <Compile Include="IO\StreamDefaults.cs" />
     <Compile Include="Net\BasePeriodicWebSocketListener.cs" />
     <Compile Include="Net\BasePeriodicWebSocketListener.cs" />
     <Compile Include="Configuration\IApplicationPaths.cs" />
     <Compile Include="Configuration\IApplicationPaths.cs" />
+    <Compile Include="Net\IHttpResultFactory.cs" />
     <Compile Include="Net\IServerManager.cs" />
     <Compile Include="Net\IServerManager.cs" />
     <Compile Include="Net\IWebSocketListener.cs" />
     <Compile Include="Net\IWebSocketListener.cs" />
     <Compile Include="IApplicationHost.cs" />
     <Compile Include="IApplicationHost.cs" />

+ 9 - 0
MediaBrowser.Common/Net/IHttpResultFactory.cs

@@ -0,0 +1,9 @@
+using System.IO;
+
+namespace MediaBrowser.Common.Net
+{
+    public interface IHttpResultFactory
+    {
+        object GetResult(Stream stream, string contentType);
+    }
+}

+ 14 - 0
MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -0,0 +1,14 @@
+using MediaBrowser.Common.Net;
+using ServiceStack.Common.Web;
+using System.IO;
+
+namespace MediaBrowser.Server.Implementations.HttpServer
+{
+    public class HttpResultFactory : IHttpResultFactory
+    {
+        public object GetResult(Stream stream, string contentType)
+        {
+            return new HttpResult(stream, contentType);
+        }
+    }
+}

+ 1 - 0
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj

@@ -106,6 +106,7 @@
     <Compile Include="BdInfo\BdInfoExaminer.cs" />
     <Compile Include="BdInfo\BdInfoExaminer.cs" />
     <Compile Include="Configuration\ServerConfigurationManager.cs" />
     <Compile Include="Configuration\ServerConfigurationManager.cs" />
     <Compile Include="HttpServer\BaseRestService.cs" />
     <Compile Include="HttpServer\BaseRestService.cs" />
+    <Compile Include="HttpServer\HttpResultFactory.cs" />
     <Compile Include="HttpServer\HttpServer.cs" />
     <Compile Include="HttpServer\HttpServer.cs" />
     <Compile Include="HttpServer\NativeWebSocket.cs" />
     <Compile Include="HttpServer\NativeWebSocket.cs" />
     <Compile Include="HttpServer\ServerFactory.cs" />
     <Compile Include="HttpServer\ServerFactory.cs" />

+ 2 - 0
MediaBrowser.ServerApplication/ApplicationHost.cs

@@ -155,6 +155,8 @@ namespace MediaBrowser.ServerApplication
 
 
             await base.RegisterResources().ConfigureAwait(false);
             await base.RegisterResources().ConfigureAwait(false);
 
 
+            RegisterSingleInstance<IHttpResultFactory>(new HttpResultFactory());
+            
             RegisterSingleInstance<IServerApplicationHost>(this);
             RegisterSingleInstance<IServerApplicationHost>(this);
             RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
             RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);