From 8ca9f26bf26c686b2a6282d4b3a6a1ffceced4da Mon Sep 17 00:00:00 2001 From: Dmitry Dzygin Date: Fri, 2 Oct 2020 13:04:26 +0200 Subject: [PATCH] Addressing compilation warnings --- .../FileConfigurationSourceImplementation.cs | 2 +- .../Pages/SeoFriendlyRedirectRouteHandler.cs | 8 +++++++ .../PageInternalUrlConverter.cs | 5 +++-- .../Routing/Pages/DefaultPageUrlProvider.cs | 22 +++++++++++++++++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Composite/Core/Configuration/FileConfigurationSourceImplementation.cs b/Composite/Core/Configuration/FileConfigurationSourceImplementation.cs index 107358c21b..d8538c7321 100644 --- a/Composite/Core/Configuration/FileConfigurationSourceImplementation.cs +++ b/Composite/Core/Configuration/FileConfigurationSourceImplementation.cs @@ -54,7 +54,7 @@ public override System.Configuration.ConfigurationSection GetSection(string sect { configurationSection = configuration.GetSection(sectionName) as System.Configuration.ConfigurationSection; } - catch (System.Configuration.ConfigurationException ex) + catch { // retry once UpdateCache(); diff --git a/Composite/Core/Routing/Pages/SeoFriendlyRedirectRouteHandler.cs b/Composite/Core/Routing/Pages/SeoFriendlyRedirectRouteHandler.cs index 6abaefd5b3..0d8d5b6b05 100644 --- a/Composite/Core/Routing/Pages/SeoFriendlyRedirectRouteHandler.cs +++ b/Composite/Core/Routing/Pages/SeoFriendlyRedirectRouteHandler.cs @@ -3,15 +3,23 @@ namespace Composite.Core.Routing.Pages { + /// + /// A route handler that performs an HTTP redirect with response code 301 (Permanently moved). + /// public class SeoFriendlyRedirectRouteHandler: IRouteHandler { private readonly string _redirectUrl; + /// + /// Creates a new instance of + /// + /// The URL to redirect to. public SeoFriendlyRedirectRouteHandler(string redirectUrl) { _redirectUrl = redirectUrl; } + /// public IHttpHandler GetHttpHandler(RequestContext requestContext) { return new SeoFriendlyRedirectHttpHandler(_redirectUrl); diff --git a/Composite/Plugins/Routing/InternalUrlConverters/PageInternalUrlConverter.cs b/Composite/Plugins/Routing/InternalUrlConverters/PageInternalUrlConverter.cs index 6cffbb0338..2cbeb377f4 100644 --- a/Composite/Plugins/Routing/InternalUrlConverters/PageInternalUrlConverter.cs +++ b/Composite/Plugins/Routing/InternalUrlConverters/PageInternalUrlConverter.cs @@ -13,9 +13,10 @@ public class PageInternalUrlConverter: IInternalUrlConverter { private static readonly string LogTitle = nameof(PageInternalUrlConverter); - private readonly string[] _acceptedUrlPrefixes = { "page(", "Renderers/Page.aspx" }; + private readonly string[] _acceptedUrlPrefixes = { "page(", "Renderers/Page.aspx" }; - public IEnumerable AcceptedUrlPrefixes { get { return _acceptedUrlPrefixes; } } + /// + public IEnumerable AcceptedUrlPrefixes => _acceptedUrlPrefixes; /// public string ToPublicUrl(string internalPageUrl, UrlSpace urlSpace) diff --git a/Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs b/Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs index 9b062ef360..ec663c74fa 100644 --- a/Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs +++ b/Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs @@ -27,7 +27,15 @@ namespace Composite.Plugins.Routing.Pages [ConfigurationElementType(typeof(NonConfigurablePageUrlProvider))] public class DefaultPageUrlProvider: IPageUrlProvider { + /// + /// Url fragment than indicates that the hostname should be ignored when resolving root page. + /// Used for internally by C1 console. + /// public static readonly string UrlMarker_RelativeUrl = "/c1mode(relative)"; + + /// + /// URL fragment that indicates that "unpublished" version of the page should be shown. + /// public static readonly string UrlMarker_Unpublished = "/c1mode(unpublished)"; private static readonly string InternalUrlPrefix = "~/page("; @@ -61,6 +69,9 @@ static DefaultPageUrlProvider() } + /// + /// Creates a new instance of + /// public DefaultPageUrlProvider() { LoadUrlSuffix(); @@ -72,6 +83,8 @@ private static void LoadUrlSuffix() .Select(c => c.PageUrlSuffix).FirstOrDefault() ?? string.Empty; } + + /// [Obsolete] public IPageUrlBuilder CreateUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace) { @@ -101,6 +114,7 @@ private static IReadOnlyCollection GetHostnameBindings() return result; } + /// public bool IsInternalUrl(string relativeUrl) { string decodedRelativeUrl = HttpUtility.UrlDecode(relativeUrl); @@ -115,10 +129,10 @@ internal static bool IsPageRendererRequest(string filePath) return filePath.EndsWith("Renderers/Page.aspx", true); } + /// public PageUrlData ParseInternalUrl(string relativeUrl) { - UrlKind urlKind; - return ParseInternalUrl(relativeUrl, out urlKind); + return ParseInternalUrl(relativeUrl, out _); } private PageUrlData ParseInternalUrl(string relativeUrl, out UrlKind urlKind) @@ -257,6 +271,7 @@ private static PageUrlData ParseRendererUrl(UrlBuilder urlBuilder) }; } + /// public PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind) { Verify.ArgumentNotNullOrEmpty(absoluteUrl, "absoluteUrl"); @@ -305,6 +320,7 @@ private bool IsKnownHostname(string hostname) return GetHostnameBindings().Any(b => b.Hostname == hostname); } + /// public PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind) { if (IsInternalUrl(relativeUrl)) @@ -565,6 +581,7 @@ private IPage TryGetPageByUrlTitlePath(string pagePath, bool pathInfoExtracted, return currentPage; } + /// protected virtual IPage FindMatchingPage(Guid parentId, string urlTitle) { foreach (var page in GetChildPages(parentId)) @@ -672,6 +689,7 @@ internal static CultureInfo GetCultureInfo(string requestPath, IHostnameBinding return DataLocalizationFacade.DefaultUrlMappingCulture; } + /// public string BuildUrl(PageUrlData pageUrlData, UrlKind urlKind, UrlSpace urlSpace) { Verify.ArgumentCondition(urlKind != UrlKind.Undefined, "urlKind", "Url kind is undefined");