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.UmbracoContext, Current.UmbracoHelper, Current.Services, Current.ProfilingLogger)
{ }
protected UmbracoHttpHandler(UmbracoContext umbracoContext, UmbracoHelper umbracoHelper, ServiceContext service, IProfilingLogger plogger)
{
UmbracoContext = umbracoContext;
Logger = plogger;
ProfilingLogger = plogger;
Services = service;
Umbraco = umbracoHelper;
}
public abstract void ProcessRequest(HttpContext context);
public abstract bool IsReusable { get; }
///
/// Gets the logger.
///
public ILogger Logger { get; }
///
/// Gets the ProfilingLogger.
///
public IProfilingLogger ProfilingLogger { get; }
///
/// Gets the Umbraco context.
///
public UmbracoContext UmbracoContext { get; }
///
/// Gets the Umbraco helper.
///
public UmbracoHelper Umbraco { get; }
///
/// Gets the services context.
///
public ServiceContext Services { get; }
///
/// Gets the web security helper.
///
public WebSecurity Security => UmbracoContext.Security;
///
/// Gets the Url helper.
///
/// This URL helper is created without any route data and an empty request context.
public UrlHelper Url => _url ?? (_url = new UrlHelper(HttpContext.Current.Request.RequestContext));
}
}