WebController

Wrapper around a controller.

Constructors

this
this(TView view)

Creates a new controller.

Public Imports

diamond.extensions
public import diamond.extensions;

Members

Functions

getByIndex
T getByIndex(size_t index, T defaultValue)

Gets a value from the route's parameters by index.

handle
Status handle()

Handles the view's current controller action.

json
Status json(T jsonObject)

Generates a json response.

jsonString
Status jsonString(string s)

Generates a json response from a json string.

redirectTo
Status redirectTo(string url, HttpStatus status)

Redirects the response to a specific url.

Mixins

__anonymous
mixin ExtensionEmit!(ExtensionType.controllerExtension, q{ mixin {{extensionEntry}}.extensions; })
Undocumented in source.

Properties

client
HttpClient client [@property getter]

Gets the client.

view
TView view [@property getter]

Gets the view.

Inherited Members

From BaseController

_data
Variant[string] _data;

Data passed by the request in a RESTful manner.

validateRoute
void validateRoute(RoutePart[] routeData, string[] sourceData)

Valiates a route and the passed source data to it.

mapValue
void mapValue(string data, string mapName)

Maps a value that was passed to the route in a RESTful manner.

ActionEntry
alias ActionEntry = Action[string]

Alias for the action entry.

MethodEntry
alias MethodEntry = ActionEntry[HttpMethod]

Alias for the method entry.

_actions
MethodEntry _actions;

Collection of actions.

_defaultAction
Action _defaultAction;

The default action for the controller.

_mandatoryAction
Action _mandatoryAction;

The mandatory action for the controller.

_noAction
Action _noAction;

The no-action handler for the controller.

handle
Status handle()

Will handle the controller.

mapAction
void mapAction(HttpMethod method, string action, Action fun)

Maps an action to a http method by a name.

mapAction
void mapAction(HttpMethod method, string action, Status delegate() d)

Maps an action to a http method by a name.

mapAction
void mapAction(HttpMethod method, string action, Status function() f)

Maps an action to a http method by a name.

mapDefault
void mapDefault(Action fun)

Maps a default action for the controller.

mapDefault
void mapDefault(Status delegate() d)

Maps a default action for the controller.

mapDefault
void mapDefault(Status function() f)

Maps a default action for the controller.

mapMandatory
void mapMandatory(Action fun)

Maps a mandatory action for the controller.

mapMandatory
void mapMandatory(Status delegate() d)

Maps a mandatory action for the controller.

mapMandatory
void mapMandatory(Status function() f)

Maps a mandatory action for the controller.

mapNoAction
void mapNoAction(Action fun)

Maps a no-action for the controller.

mapNoAction
void mapNoAction(Status delegate() d)

Maps a no-action for the controller.

mapNoAction
void mapNoAction(Status function() f)

Maps a no-action for the controller.

get
T get(string name, T defaultValue)

Gets a value from the passed data.

testing
bool testing [@property getter]

Gets a boolean determnining whether the request is a test or not.

Meta