API Docs for:
Show:

response Class

Module: API

Controls the response to the current response. Accessed via the global variable 'response'.

Methods

write

(
  • text
)

Write the given text to the body of the response.

Parameters:

  • text String

    Text to write to the response.

writeUsingTemplateFile

(
  • templateFilePath
  • data
)

Apply the given data to the template in the given file and write the result to the response. The template engine can also be accessed via the Template/renderFile:method method, which doesn't write to the response.

Parameters:

  • templateFilePath String

    Path to template file.

  • data Object

    Object containing values to substitute into the template.

writeUsingTemplateString

(
  • template
  • data
)

Apply the given data to the given template and write the result to the response. The template engine can also be accessed via the Template/renderString:method method, which doesn't write to the response.

Parameters:

  • template String
  • data Object

    Object containing values to substitute into the template.

Properties

downloadFile

String

Path of file that the client will download. If this property is set to a value other than null then the response will be to have the client download the file with the given virtual file-system path.

Default: null

forceDownload

Boolean

Should the client be forced to download the file (as opposed to possibly rendering it in the browser)? If this property is set to true then "content-disposition" field will be set in the HTTP header, which is usually interpreted by the browser to mean that the response will be saved to a file rather than rendered in the browser.

Default: false

redirectUrl

String

URL to redirect to. If redirectUrl is set then the client will be redirected to the specified URL.

Default: null