aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-08 11:55:53 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-08 11:55:53 -0400
commit804115bf8d526477756828ff4ca632c351e03b90 (patch)
tree8da201ceb75bd07b816717d363ae6b41e343bbf5 /MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
parent59cfad03e8839556639e5a00abba1a8e6a959b18 (diff)
remove and/or delay unnecessary startup work
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
index 6aea83410..c2a936f1c 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
@@ -50,12 +50,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
private readonly List<IRestfulService> _restServices = new List<IRestfulService>();
/// <summary>
- /// Gets or sets the application host.
- /// </summary>
- /// <value>The application host.</value>
- private IApplicationHost ApplicationHost { get; set; }
-
- /// <summary>
/// This subscribes to HttpListener requests and finds the appropriate BaseHandler to process it
/// </summary>
/// <value>The HTTP listener.</value>
@@ -78,6 +72,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <value>The name of the server.</value>
private string ServerName { get; set; }
+ private ContainerAdapter _containerAdapter;
+
/// <summary>
/// Initializes a new instance of the <see cref="HttpServer" /> class.
/// </summary>
@@ -109,10 +105,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
ServerName = serverName;
DefaultRedirectPath = defaultRedirectpath;
_logger = logger;
- ApplicationHost = applicationHost;
EndpointHostConfig.Instance.ServiceStackHandlerFactoryPath = null;
EndpointHostConfig.Instance.MetadataRedirectPath = "metadata";
+
+ _containerAdapter = new ContainerAdapter(applicationHost);
}
protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
@@ -135,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
WriteErrorsToResponse = false
});
- container.Adapter = new ContainerAdapter(ApplicationHost);
+ container.Adapter = _containerAdapter;
Plugins.Add(new SwaggerFeature());
Plugins.Add(new CorsFeature());
@@ -214,6 +211,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (Listener == null)
{
+ _logger.Info("Creating HttpListner");
Listener = new HttpListener();
}
@@ -221,11 +219,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer
UrlPrefix = urlBase;
+ _logger.Info("Adding HttpListener Prefixes");
Listener.Prefixes.Add(urlBase);
IsStarted = true;
+ _logger.Info("Starting HttpListner");
Listener.Start();
+ _logger.Info("Creating HttpListner observable stream");
HttpListener = CreateObservableStream().Subscribe(ProcessHttpRequestAsync);
}
@@ -548,6 +549,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
_restServices.AddRange(services);
_logger.Info("Calling EndpointHost.ConfigureHost");
+
EndpointHost.ConfigureHost(this, ServerName, CreateServiceManager());
_logger.Info("Calling ServiceStack AppHost.Init");