Merge pull request #9762 from umbraco/netcore/task/Surface-Routing-9717
SurfaceController routing for netcore
This commit is contained in:
@@ -7,14 +7,12 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public static class Web
|
||||
{
|
||||
public const string UmbracoRouteDefinitionDataToken = "umbraco-route-def";
|
||||
|
||||
/// <summary>
|
||||
/// The preview cookie name
|
||||
/// </summary>
|
||||
public const string PreviewCookieName = "UMB_PREVIEW";
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Client-side cookie that determines whether the user has accepted to be in Preview Mode when visiting the website.
|
||||
/// </summary>
|
||||
public const string AcceptPreviewCookieName = "UMB-WEBSITE-PREVIEW-ACCEPT";
|
||||
@@ -54,6 +52,13 @@ namespace Umbraco.Core
|
||||
public const string BackOfficeApiArea = "UmbracoApi"; // Same name as v8 so all routing remains the same
|
||||
public const string BackOfficeTreeArea = "UmbracoTrees"; // Same name as v8 so all routing remains the same
|
||||
}
|
||||
|
||||
public static class Routing
|
||||
{
|
||||
public const string ControllerToken = "controller";
|
||||
public const string ActionToken = "action";
|
||||
public const string AreaToken = "area";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
|
||||
public class UmbracoApplicationStarting : INotification
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
23
src/Umbraco.Core/Events/UmbracoRequestBegin.cs
Normal file
23
src/Umbraco.Core/Events/UmbracoRequestBegin.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Notification raised on each request begin.
|
||||
/// </summary>
|
||||
public class UmbracoRequestBegin : INotification
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoRequestBegin"/> class.
|
||||
/// </summary>
|
||||
public UmbracoRequestBegin(IUmbracoContext umbracoContext) => UmbracoContext = umbracoContext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IUmbracoContext"/>
|
||||
/// </summary>
|
||||
public IUmbracoContext UmbracoContext { get; }
|
||||
}
|
||||
}
|
||||
23
src/Umbraco.Core/Events/UmbracoRequestEnd.cs
Normal file
23
src/Umbraco.Core/Events/UmbracoRequestEnd.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Notification raised on each request end.
|
||||
/// </summary>
|
||||
public class UmbracoRequestEnd : INotification
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoRequestEnd"/> class.
|
||||
/// </summary>
|
||||
public UmbracoRequestEnd(IUmbracoContext umbracoContext) => UmbracoContext = umbracoContext;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IUmbracoContext"/>
|
||||
/// </summary>
|
||||
public IUmbracoContext UmbracoContext { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the outcome of trying to route an incoming request.
|
||||
/// </summary>
|
||||
public enum EnsureRoutableOutcome
|
||||
{
|
||||
/// <summary>
|
||||
/// Request routes to a document.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Umbraco was ready and configured, and has content.</para>
|
||||
/// <para>The request looks like it can be a route to a document. This does not
|
||||
/// mean that there *is* a matching document, ie the request might end up returning
|
||||
/// 404.</para>
|
||||
/// </remarks>
|
||||
IsRoutable = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Request does not route to a document.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Umbraco was ready and configured, and has content.</para>
|
||||
/// <para>The request does not look like it can be a route to a document. Can be
|
||||
/// anything else eg back-office, surface controller...</para>
|
||||
/// </remarks>
|
||||
NotDocumentRequest = 10,
|
||||
|
||||
/// <summary>
|
||||
/// Umbraco was not ready.
|
||||
/// </summary>
|
||||
NotReady = 11,
|
||||
|
||||
/// <summary>
|
||||
/// There was no content at all.
|
||||
/// </summary>
|
||||
NoContent = 12
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Event args containing information about why the request was not routable, or if it is routable
|
||||
/// </summary>
|
||||
public class RoutableAttemptEventArgs : UmbracoRequestEventArgs
|
||||
{
|
||||
public EnsureRoutableOutcome Outcome { get; private set; }
|
||||
|
||||
public RoutableAttemptEventArgs(EnsureRoutableOutcome reason, IUmbracoContext umbracoContext)
|
||||
: base(umbracoContext)
|
||||
{
|
||||
Outcome = reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Umbraco.Web.Routing
|
||||
{
|
||||
/// <summary>
|
||||
/// Event args used for event launched during a request (like in the UmbracoModule)
|
||||
/// </summary>
|
||||
public class UmbracoRequestEventArgs : EventArgs
|
||||
{
|
||||
public IUmbracoContext UmbracoContext { get; private set; }
|
||||
|
||||
public UmbracoRequestEventArgs(IUmbracoContext umbracoContext)
|
||||
{
|
||||
UmbracoContext = umbracoContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,22 @@ namespace Umbraco.Web
|
||||
{
|
||||
public interface IRequestAccessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the request/form/querystring value for the given name
|
||||
/// </summary>
|
||||
string GetRequestValue(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the query string value for the given name
|
||||
/// </summary>
|
||||
string GetQueryStringValue(string name);
|
||||
event EventHandler<UmbracoRequestEventArgs> EndRequest;
|
||||
event EventHandler<RoutableAttemptEventArgs> RouteAttempt;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current request uri
|
||||
/// </summary>
|
||||
Uri GetRequestUrl();
|
||||
|
||||
// TODO: Not sure this belongs here but we can leave it for now
|
||||
// TODO: This doesn't belongs here
|
||||
Uri GetApplicationUrl();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user