HttpController

module:most-web.mvc. HttpController

Provides methods that respond to HTTP requests that are made to a web application

Constructor

new HttpController(context)

Parameters:
Name Type Description
context HttpContext The executing HTTP context.
Properties:
Name Type Description
context HttpContext Gets or sets the HTTP context associated with this controller
name string Gets or sets the internal name for this controller
Source:

Members

htm

Creates a view result object for the given request.
Source:

Methods

action(action, callback)

Invokes a default action and returns an HttpViewResult instance
Parameters:
Name Type Description
action String
callback function
Source:

content()

Creates a content result object by using a string.
Source:
Returns:
HttpContentResult

empty()

Creates an empty result object.
Source:
Returns:
HttpEmptyResult

file(physicalPath, fileNameopt) → {HttpFileResult|HttpResult}

Creates a binary file result object by using the specified path.
Parameters:
Name Type Attributes Description
physicalPath string
fileName string <optional>
Source:
Returns:
Type
HttpFileResult | HttpResult

html(dataopt)

Creates a view result object for the given request.
Parameters:
Name Type Attributes Description
data * <optional>
Source:
Returns:
HttpViewResult

js(dataopt)

Creates a view result object for the given request.
Parameters:
Name Type Attributes Description
data String <optional>
Source:
Returns:
HttpJavascriptResult

json()

Creates a JSON result object by using the specified data.
Source:
Returns:
HttpJsonResult

jsvar(name, obj)

Creates a view result object that represents a client javascript object. This result may be used for sharing specific objects stored in memory or server filesystem e.g. serve a *.json file as a client variable with name window.myVar1 or serve user settings object ({ culture: 'en-US', notifyMe: false}) as a variable with name window.settings
Parameters:
Name Type Description
name String
obj String | *
Source:
Returns:
HttpResult

redirect()

Creates a redirect result object that redirects to the specified URL.
Source:
Returns:
HttpRedirectResult

result(dataopt)

Creates a view result based on the context content type
Parameters:
Name Type Attributes Description
data * <optional>
Source:
Returns:
HttpViewResult

view(dataopt) → {module.HttpViewResult}

Creates a view result object for the given request.
Parameters:
Name Type Attributes Description
data * <optional>
Source:
Returns:
Type
module.HttpViewResult

xml()

Creates a XML result object by using the specified data.
Source:
Returns:
HttpXmlResult