Files
Umbraco-CMS/src/Umbraco.Web/UmbracoHttpHandler.cs
Elitsa Marinovska 84f19e093a NetCore: Refactor internal usages of UmbracoHelper (#7744)
* Removing properties related to IPublishedContentQuery, ITagQuery, ICultureDictionaryFactory, IUmbracoComponentRenderer from UmbracoHelper and using the corresponding private fields instead. Removing Media related methods

* Removed UmbracoHelper from UmbracoApiControllerBase

* Removed UmbracoHelper references

* Inject the needed Interfaces to classes that previously used UmbracoHelper to get the same functionality

* Fixed tests referencing UmbracoHelper

* Adding Media methods back

* Cleanup and moved UmbracoHelper from more base classes, when not used + simplified tests

* Reintroduced some methods..

* Reintroduced some methods..

* Reintroducing last missing bits

Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2020-03-03 11:59:17 +01:00

64 lines
1.9 KiB
C#

using System;
using System.Web;
using System.Web.Mvc;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Services;
using Umbraco.Web.Composing;
using Umbraco.Web.Security;
namespace Umbraco.Web
{
public abstract class UmbracoHttpHandler : IHttpHandler
{
private UrlHelper _url;
protected UmbracoHttpHandler()
: this(Current.UmbracoContextAccessor, Current.Services, Current.ProfilingLogger)
{ }
protected UmbracoHttpHandler(IUmbracoContextAccessor umbracoContextAccessor,ServiceContext service, IProfilingLogger plogger)
{
UmbracoContextAccessor = umbracoContextAccessor;
Logger = plogger;
ProfilingLogger = plogger;
Services = service;
}
public abstract void ProcessRequest(HttpContext context);
public abstract bool IsReusable { get; }
/// <summary>
/// Gets the logger.
/// </summary>
public ILogger Logger { get; }
/// <summary>
/// Gets the ProfilingLogger.
/// </summary>
public IProfilingLogger ProfilingLogger { get; }
/// <summary>
/// Gets the Umbraco context accessor.
/// </summary>
public IUmbracoContextAccessor UmbracoContextAccessor { get; }
/// <summary>
/// Gets the services context.
/// </summary>
public ServiceContext Services { get; }
/// <summary>
/// Gets the web security helper.
/// </summary>
public IWebSecurity Security => UmbracoContextAccessor.UmbracoContext.Security;
/// <summary>
/// Gets the Url helper.
/// </summary>
/// <remarks>This URL helper is created without any route data and an empty request context.</remarks>
public UrlHelper Url => _url ?? (_url = new UrlHelper(HttpContext.Current.Request.RequestContext));
}
}