private Task DocumentConfiguration(IOwinContext context) { Func <string[], string> f = a => { if (a == null) { return("null"); } return("[<br>\"" + string.Join("\",<br>\"", a) + "\"<br>]"); }; var document = GetEmbeddedResource("configuration.html"); document = document.Replace("{documentationRootUrl}", _configuration.DocumentationRootUrl); document = document.Replace("{version}", _configuration.Version.ToString()); document = document.Replace("{mimeTypes}", f(_configuration.MimeTypes)); document = document.Replace("{fileExtensions}", f(_configuration.FileExtensions)); document = document.Replace("{browserCacheTime}", _configuration.BrowserCacheTime.ToString()); document = document.Replace("{exactVersion}", _configuration.ExactVersion.ToString()); document = document.Replace("{analyticsEnabled}", _configuration.AnalyticsEnabled.ToString()); var defaultConfiguration = new VersioningConfiguration(); document = document.Replace("{documentationRootUrl.default}", defaultConfiguration.DocumentationRootUrl); document = document.Replace("{version.default}", defaultConfiguration.Version.ToString()); document = document.Replace("{mimeTypes.default}", f(defaultConfiguration.MimeTypes)); document = document.Replace("{fileExtensions.default}", f(defaultConfiguration.FileExtensions)); document = document.Replace("{browserCacheTime.default}", defaultConfiguration.BrowserCacheTime.ToString()); document = document.Replace("{exactVersion.default}", defaultConfiguration.ExactVersion.ToString()); document = document.Replace("{analyticsEnabled.default}", defaultConfiguration.AnalyticsEnabled.ToString()); context.Response.ContentType = "text/html"; return(context.Response.WriteAsync(document)); }
public VersioningContext( IOwinContext context, VersioningConfiguration configuration, TraceFilter traceFilter) { OriginalUrl = new Uri(context.Request.Uri.ToString()); OriginalPath = new PathString(context.Request.Path.Value); _configuration = configuration; _traceFilter = traceFilter; }
private void ConfigurationChanged(VersioningConfiguration configuration) { _configuration = configuration; }