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
Implements
System.Web.Mvc.Async.IAsyncController
System.Web.Mvc.IController
System.Web.Mvc.Async.IAsyncManagerContainer
Namespace: EPiServer.Shell.Services.Rest
Assembly: EPiServer.Shell.dll
Version: 8.11.0
Syntax
[CompressFilter]
public abstract class RestControllerBase : ControllerBase, IAsyncController, IController, IAsyncManagerContainer

Constructors

RestControllerBase()

Initializes a new instance of the RestControllerBase class.

Declaration
protected RestControllerBase()

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

By default of type RestControllerActionInvoker

AsyncManager

Gets the asynchronous manager object.

Declaration
public AsyncManager AsyncManager { get; }
Property Value
Type Description
System.Web.Mvc.Async.AsyncManager

DisableAsyncSupport

Derived classes can override this flag and set to true if they need the pre-MVC 4 ExecuteCore to be called.

Declaration
protected virtual bool DisableAsyncSupport { get; }
Property Value
Type Description
System.Boolean

Returns true when ActionInvoker is System.Web.Mvc.Async.IAsyncActionInvoker

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

BeginExecute(RequestContext, AsyncCallback, Object)

Executes the specified request context.

Declaration
public IAsyncResult BeginExecute(RequestContext requestContext, AsyncCallback callback, object state)
Parameters
Type Name Description
System.Web.Routing.RequestContext requestContext

The request context.

System.AsyncCallback callback

The asynchronous callback method.

System.Object state

The state.

Returns
Type Description
System.IAsyncResult

The status of the asynchronous operation.

EndExecute(IAsyncResult)

Ends the asynchronous operation.

Declaration
public void EndExecute(IAsyncResult asyncResult)
Parameters
Type Name Description
System.IAsyncResult asyncResult

The asynchronous result.

ExecuteCore()

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

Declaration
protected override void ExecuteCore()

GetActionName()

Get the action method to process

Declaration
protected virtual string GetActionName()
Returns
Type Description
System.String

The action method by checking both HTTP method and special header "X-Http-Method-Override"

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.

Implements

System.Web.Mvc.Async.IAsyncController
System.Web.Mvc.IController
System.Web.Mvc.Async.IAsyncManagerContainer