From a208c95a4f6d8858c305e1dc4d7ba4058ff0dd03 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 11 Dec 2015 11:12:52 -0800 Subject: [PATCH] Deleted stale files from earlier deleted test website UrlHelperWebSite --- .../UrlHelperWebSite/CustomUrlHelper.cs | 68 ------------------- .../CustomUrlHelperFactory.cs | 24 ------- test/WebSites/UrlHelperWebSite/Startup.cs | 40 ----------- 3 files changed, 132 deletions(-) delete mode 100644 test/WebSites/UrlHelperWebSite/CustomUrlHelper.cs delete mode 100644 test/WebSites/UrlHelperWebSite/CustomUrlHelperFactory.cs delete mode 100644 test/WebSites/UrlHelperWebSite/Startup.cs diff --git a/test/WebSites/UrlHelperWebSite/CustomUrlHelper.cs b/test/WebSites/UrlHelperWebSite/CustomUrlHelper.cs deleted file mode 100644 index 388593137f..0000000000 --- a/test/WebSites/UrlHelperWebSite/CustomUrlHelper.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNet.Http; -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Infrastructure; -using Microsoft.AspNet.Mvc.Routing; -using Microsoft.Extensions.OptionsModel; - -namespace UrlHelperWebSite -{ - /// - /// Following are some of the scenarios exercised here: - /// 1. Based on configuration, generate Content urls pointing to local or a CDN server - /// 2. Based on configuration, generate lower case urls - /// - public class CustomUrlHelper : UrlHelper - { - private readonly AppOptions _options; - - public CustomUrlHelper(ActionContext actionContext, AppOptions options) - : base(actionContext) - { - _options = options; - } - - /// - /// Depending on config data, generates an absolute url pointing to a CDN server - /// or falls back to the default behavior - /// - /// - /// - public override string Content(string contentPath) - { - if (_options.ServeCDNContent - && contentPath.StartsWith("~/", StringComparison.Ordinal)) - { - var segment = new PathString(contentPath.Substring(1)); - - return ConvertToLowercaseUrl(_options.CDNServerBaseUrl + segment); - } - - return ConvertToLowercaseUrl(base.Content(contentPath)); - } - - public override string RouteUrl(UrlRouteContext routeContext) - { - return ConvertToLowercaseUrl(base.RouteUrl(routeContext)); - } - - public override string Action(UrlActionContext actionContext) - { - return ConvertToLowercaseUrl(base.Action(actionContext)); - } - - private string ConvertToLowercaseUrl(string url) - { - if (!string.IsNullOrEmpty(url) - && _options.GenerateLowercaseUrls) - { - return url.ToLowerInvariant(); - } - - return url; - } - } -} \ No newline at end of file diff --git a/test/WebSites/UrlHelperWebSite/CustomUrlHelperFactory.cs b/test/WebSites/UrlHelperWebSite/CustomUrlHelperFactory.cs deleted file mode 100644 index 7b95ce7b87..0000000000 --- a/test/WebSites/UrlHelperWebSite/CustomUrlHelperFactory.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Mvc; -using Microsoft.AspNet.Mvc.Routing; -using Microsoft.Extensions.OptionsModel; - -namespace UrlHelperWebSite -{ - public class CustomUrlHelperFactory : IUrlHelperFactory - { - private readonly AppOptions _options; - - public CustomUrlHelperFactory(IOptions options) - { - _options = options.Value; - } - - public IUrlHelper GetUrlHelper(ActionContext context) - { - return new CustomUrlHelper(context, _options); - } - } -} diff --git a/test/WebSites/UrlHelperWebSite/Startup.cs b/test/WebSites/UrlHelperWebSite/Startup.cs deleted file mode 100644 index d299c79579..0000000000 --- a/test/WebSites/UrlHelperWebSite/Startup.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNet.Builder; -using Microsoft.AspNet.Mvc.Routing; -using Microsoft.Extensions.DependencyInjection; - -namespace UrlHelperWebSite -{ - public class Startup - { - // Set up application services - public void ConfigureServices(IServiceCollection services) - { - services.Configure(optionsSetup => - { - optionsSetup.ServeCDNContent = true; - optionsSetup.CDNServerBaseUrl = "http://cdn.contoso.com"; - optionsSetup.GenerateLowercaseUrls = true; - }); - - // Add MVC services to the services container - services.AddMvc(); - - services.AddSingleton(); - } - - public void Configure(IApplicationBuilder app) - { - app.UseCultureReplacer(); - - - // Add MVC to the request pipeline - app.UseMvc(routes => - { - routes.MapRoute("Default", "{controller=Home}/{action=Index}"); - }); - } - } -}