Removed old JsonNetResult, MinifyJavaScriptResultAttribute, UmbracoViewPage
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Custom json result using newtonsoft json.net
|
||||
/// </summary>
|
||||
/// Migrated already to .Net Core
|
||||
public class JsonNetResult : ActionResult
|
||||
{
|
||||
public Encoding ContentEncoding { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
public object Data { get; set; }
|
||||
|
||||
public JsonSerializerSettings SerializerSettings { get; set; }
|
||||
public Formatting Formatting { get; set; }
|
||||
|
||||
public JsonNetResult()
|
||||
{
|
||||
SerializerSettings = new JsonSerializerSettings();
|
||||
}
|
||||
|
||||
public override void ExecuteResult(ControllerContext context)
|
||||
{
|
||||
if (context == null)
|
||||
throw new ArgumentNullException("context");
|
||||
|
||||
HttpResponseBase response = context.HttpContext.Response;
|
||||
|
||||
response.ContentType = string.IsNullOrEmpty(ContentType) == false
|
||||
? ContentType
|
||||
: "application/json";
|
||||
|
||||
if (ContentEncoding != null)
|
||||
response.ContentEncoding = ContentEncoding;
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
var writer = new JsonTextWriter(response.Output) { Formatting = Formatting };
|
||||
|
||||
var serializer = JsonSerializer.Create(SerializerSettings);
|
||||
serializer.Serialize(writer, Data);
|
||||
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Web.Mvc;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Core.WebAssets;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// Minifies the result for the JavaScriptResult
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only minifies in release mode
|
||||
/// </remarks>
|
||||
/// Migrated already to .Net Core
|
||||
public class MinifyJavaScriptResultAttribute : ActionFilterAttribute
|
||||
{
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IRuntimeMinifier _runtimeMinifier;
|
||||
|
||||
public MinifyJavaScriptResultAttribute()
|
||||
{
|
||||
_hostingEnvironment = Current.HostingEnvironment;
|
||||
_runtimeMinifier = Current.RuntimeMinifier;
|
||||
}
|
||||
|
||||
public MinifyJavaScriptResultAttribute(IHostingEnvironment hostingEnvironment, IRuntimeMinifier runtimeMinifier)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_runtimeMinifier = runtimeMinifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minify the result if in release mode
|
||||
/// </summary>
|
||||
/// <param name="filterContext"></param>
|
||||
public override void OnResultExecuting(ResultExecutingContext filterContext)
|
||||
{
|
||||
base.OnResultExecuting(filterContext);
|
||||
|
||||
if (filterContext.Result == null) return;
|
||||
var jsResult = filterContext.Result as JavaScriptResult;
|
||||
if (jsResult == null) return;
|
||||
if (_hostingEnvironment.IsDebugMode) return;
|
||||
|
||||
//minify the result
|
||||
var result = jsResult.Script;
|
||||
var minified = _runtimeMinifier.MinifyAsync(result, AssetType.Javascript).GetAwaiter().GetResult();
|
||||
jsResult.Script = minified;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Web.WebPages;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
public abstract class UmbracoViewPage : UmbracoViewPage<IPublishedContent>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -268,10 +268,7 @@
|
||||
<Compile Include="Mvc\PreRenderViewActionFilterAttribute.cs" />
|
||||
<Compile Include="Mvc\RedirectToUmbracoUrlResult.cs" />
|
||||
<Compile Include="Mvc\UmbracoVirtualNodeByIdRouteHandler.cs" />
|
||||
<Compile Include="Mvc\JsonNetResult.cs" />
|
||||
<Compile Include="Mvc\MinifyJavaScriptResultAttribute.cs" />
|
||||
<Compile Include="Mvc\EnsurePublishedContentRequestAttribute.cs" />
|
||||
<Compile Include="Mvc\UmbracoViewPage.cs" />
|
||||
<Compile Include="Mvc\UmbracoVirtualNodeRouteHandler.cs" />
|
||||
<Compile Include="Security\AppBuilderExtensions.cs" />
|
||||
<Compile Include="Security\AuthenticationOptionsExtensions.cs" />
|
||||
|
||||
Reference in New Issue
Block a user