SaaS CMS has officially launched! Learn more now.

Class RestRoute

Defines a route for a collection of REST stores.

Inheritance
System.Object
RestRoute
Namespace: EPiServer.Shell.Services.Rest
Assembly: EPiServer.Shell.dll
Version: 8.11.0
Syntax
public class RestRoute : RouteBase

Constructors

RestRoute(String, IRouteHandler)

Initializes a new instance of the RestRoute class.

Declaration
public RestRoute(string url, IRouteHandler routeHandler)
Parameters
Type Name Description
System.String url

The base url for the contained stores.

System.Web.Routing.IRouteHandler routeHandler

The route handler handling requests mapped to this route.

RestRoute(String, IRouteHandler, IServiceLocator)

Initializes a new instance of the RestRoute class.

Declaration
public RestRoute(string url, IRouteHandler routeHandler, IServiceLocator serviceLocator)
Parameters
Type Name Description
System.String url

The base url for the contained stores.

System.Web.Routing.IRouteHandler routeHandler

The route handler handling requests mapped to this route.

IServiceLocator serviceLocator

The service locator providing controller instances.

Properties

AppRelativeUrl

The Url mapped to the application root.

Declaration
public string AppRelativeUrl { get; }
Property Value
Type Description
System.String

RouteHandler

Gets or sets the route handler.

Declaration
public IRouteHandler RouteHandler { get; }
Property Value
Type Description
System.Web.Routing.IRouteHandler

The route handler.

Stores

A collection of registered stores mapped to the route path.

Declaration
public IDictionary<string, Type> Stores { get; }
Property Value
Type Description
System.Collections.Generic.IDictionary<System.String, System.Type>

Url

Gets or sets the URL for which this route is registered.

Declaration
public string Url { get; }
Property Value
Type Description
System.String

Methods

Equals(Object)

Compares against another route.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The route to compare.

Returns
Type Description
System.Boolean

true if the compared object has the same url.

GetHashCode()

Gets the hash code.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code based on the route url.

GetRouteData(HttpContextBase)

When overridden in a derived class, returns route information about the request.

Declaration
public override RouteData GetRouteData(HttpContextBase httpContext)
Parameters
Type Name Description
System.Web.HttpContextBase httpContext

An object that encapsulates information about the HTTP request.

Returns
Type Description
System.Web.Routing.RouteData

An object that contains the values from the route definition if the route matches the current request, or null if the route does not match the request.

GetVirtualPath(RequestContext, RouteValueDictionary)

Checks whether the route matches the specified values, and if so, generates a URL and retrieves information about the route.

Declaration
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
Parameters
Type Name Description
System.Web.Routing.RequestContext requestContext

An object that encapsulates information about the requested route.

System.Web.Routing.RouteValueDictionary values

An object that contains the parameters for a route.

Returns
Type Description
System.Web.Routing.VirtualPathData

This implementation always returns null

TryCreateController(String, out IController)

Try to create a controller mapped to a store by the registered store name.

Declaration
public virtual bool TryCreateController(string storeName, out IController controller)
Parameters
Type Name Description
System.String storeName

Name of the store.

System.Web.Mvc.IController controller

The created controller controller.

Returns
Type Description
System.Boolean

true if a controller was found and successfully created; otherwise false.