ApiActionController Class
Deprecated: Since 0.4.1
Controller interface used to map simple actions to handlers and provide a flow for validation and error handling.
Constructor
ApiActionController
()
deprecated
Item Index
Methods
- checkForFormRefill
- displayErrorOrSuccessCallback
- formError
- getActions
- getAutoSanitize
- getJSONPostParams deprecated
- getPageName
- getPostData
- getPostParams
- getSanitizationRules
- getServiceContext
- getTemplateServiceInstance
- hasRequiredParams
- init
- initSync
- onLocalizedAlternateFlagFound
- redirect
- render
- requiresClientLocalization
- requiresClientLocalizationCallback
- sanitizeObject
- setAutoSanitize
- setFormFieldValues
- setPageName
- validateParameters
- validatePathParameters
- validatePostParameters
- validateQueryParameters
Properties
- activeTheme
- autoSanitize
- body
- context
- localizationService deprecated
- ls
- pageName
- pathVars
- query
- referer deprecated
- req
- reqHandler
- res
- session
- ts
Methods
checkForFormRefill
-
result -
cb
Parameters:
-
resultString -
cbFunction
displayErrorOrSuccessCallback
-
flag -
cb
Parameters:
-
flagString -
cbFunction
formError
-
message -
redirectLocation -
cb
Parameters:
-
messageStringThe error message to be displayed -
redirectLocationString -
cbFunction
getActions
()
Object
Provides the hash of all actions supported by this controller
Returns:
An empty hash of actions since this is meant to be overriden.
getAutoSanitize
()
Returns:
{Boolean
getJSONPostParams
-
cb
Parameters:
-
cbFunction
getPageName
()
String
Returns:
getPostData
-
cb
Parameters:
-
cbFunction
getPostParams
-
cb
Parameters:
-
cbFunction
getSanitizationRules
()
Object
Returns:
getServiceContext
()
Object
Returns:
getTemplateServiceInstance
-
props
Parameters:
-
propsObject
Returns:
hasRequiredParams
-
queryObject -
requiredParameters
Parameters:
-
queryObjectObject -
requiredParametersArray
init
-
props -
cb
- locale - The selected locale for the request (NOTE: this may not match the requested language if not supported)
- error_success - An alert box if one was registered by the controller
- page_name - The title of the page
- localization_script - Includes the localization script so that it can be used client side
- analytics - Inserts the necessary javascript for analytics providers
Parameters:
-
propsObjectThe properties needed to initialize the controller
-
request_handlerRequestHandler -
requestRequestThe incoming request
-
responseResponseThe outgoing response
-
sessionObjectThe session object
-
localization_serviceLocalizationThe localization service instance for the request
-
path_varsObjectThe path variables associated with the URL for the request
-
queryObjectThe query string variables associated with the URL for the request
-
-
cbFunctionA callback that takes a single optional argument: cb(Error)
initSync
-
context
Parameters:
-
contextObjectSee "init" for more details on properties
onLocalizedAlternateFlagFound
-
routeLocalized -
cb
Parameters:
-
routeLocalizedBoolean -
cbFunction
redirect
-
location -
cb
Parameters:
-
locationString -
cbFunction
render
-
cb
The entry point called by the RequestHandler. Executes the calls to the validation framework then, if passes, executes the action handler.
Parameters:
-
cbFunction
requiresClientLocalization
()
Boolean
Returns:
requiresClientLocalizationCallback
-
flag -
cb
Parameters:
-
flagString -
cbFunction
sanitizeObject
-
obj
Parameters:
-
objObject
setAutoSanitize
-
val
Parameters:
-
valBoolean
setFormFieldValues
-
post
Parameters:
-
postObject
setPageName
-
pageName
Parameters:
-
pageNameStringThe desired page title
validateParameters
-
action -
cb
Validates the query, path, and post parameters in parallel and calls back with any validation errors.
Parameters:
-
actionString -
cbFunction
validatePathParameters
-
action -
cb
Validates any path parameters for the specified action. The callback will provide an array of validation errors. When the array is empty it is safe to assume that validation succeeded. The default implementation examines the value for the action in the value returned by ApiActionController#getActions. If the value evaluates to true then the implementation will validate that an "id" path parameter was passed.
Parameters:
-
actionString -
cbFunction
validatePostParameters
-
action -
post -
cb
Validates any post parameters for the specified action. The callback will provide an array of validation errors. When the array is empty it is safe to assume that validation succeeded. The default implementation passes an empty error array.
Parameters:
-
actionString -
postObject -
cbFunction
validateQueryParameters
-
action -
cb
Validates any query parameters for the specified action. The callback will provide an array of validation errors. When the array is empty it is safe to assume that validation succeeded. The default implementation passes an empty error array.
Parameters:
-
actionString -
cbFunction
Properties
activeTheme
String
autoSanitize
Boolean
Flag to indicate if the form should automatically sanitize the incoming values. In this case sanitize means it will attempt to strip away any HTML tags to prevent HTML injection and XSS.
