SaaS CMS has officially launched! Learn more now.

Class RestControllerBase

Serves as base class for controller implementations adhering to a REST pattern.

Inheritance
System.Object
RestControllerBase
Namespace: EPiServer.Shell.Services.Rest
Assembly: EPiServer.Shell.dll
Version: 7.19.2
Syntax
[CompressFilter]
public abstract class RestControllerBase : ControllerBase

Constructors

RestControllerBase()

Initializes a new instance of the RestControllerBase class.

Declaration
protected RestControllerBase()

RestControllerBase(IEnumerable<IRestControllerValueProvider>, IObjectSerializerFactory)

Initializes a new instance of the RestControllerBase class.

Declaration
[Obsolete("Use the parameterless constructor instead")]
protected RestControllerBase(IEnumerable<IRestControllerValueProvider> valueProviders, IObjectSerializerFactory serializerFactory)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IRestControllerValueProvider> valueProviders

The value providers used to resolve parameters values.

IObjectSerializerFactory serializerFactory

The serializer factory that is used to get content serializers.

Properties

ActionInvoker

Gets or sets the action invoker used when invoking the controller rest action.

Declaration
public IActionInvoker ActionInvoker { get; set; }
Property Value
Type Description
System.Web.Mvc.IActionInvoker

HttpContext

Gets the HTTP context in which the request is executed.

Declaration
public HttpContextBase HttpContext { get; }
Property Value
Type Description
System.Web.HttpContextBase

RouteData

Gets the URL route data.

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

User

Gets the security context of the user on whose behalf the code is running.

Declaration
public IPrincipal User { get; }
Property Value
Type Description
System.Security.Principal.IPrincipal

Methods

ExecuteCore()

Executes the action corresponding to the http method in the request.

Declaration
protected override void ExecuteCore()

Rest(IEnumerable<Object>, ItemRange)

Helper method creating a RestResult with the specified data filtered to a given range.

Declaration
protected RestResult Rest(IEnumerable<object> data, ItemRange range)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> data

The data to be filtered and then return in the response.

ItemRange range

The item range to apply to the given data and apply to the response header.

Returns
Type Description
RestResult

A Rest Action result with the filtered data and Content-Range header.

Rest(Object)

Helper method creating a RestResult with the specified data.

Declaration
protected RestResult Rest(object data)
Parameters
Type Name Description
System.Object data

The data to return for the request.

Returns
Type Description
RestResult

A Rest Action result with the supplied data.

Extension Methods