response

Namespace

response

Description:
  • Web-apps only

    Controls the response to the current HTTP request. Accessed via the global variable response. This variable is only available when the script has been invoked by a HTTP request.

Source:

Members

(static) contentType :String

Description:
  • HTML Content-Type of the response.

Source:

HTML Content-Type of the response.

Type:
  • String

(static) downloadFile :String

Description:
  • 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.

Source:

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.

Type:
  • String

(static) downloadName :String

Description:
  • File-name provided to the browser for the downloadFile.

Source:

File-name provided to the browser for the downloadFile.

Type:
  • String

(static) forceDownload :Boolean

Description:
  • 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.

Source:
Default Value:
  • false

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.

Type:
  • Boolean

(static) headers :Object

Description:
  • Provides access to the headers of the response. The names of the fields of the returned object are those of the headers.

    Method:

    • add(name, value) adds a header field with the given name and value.
Source:

Provides access to the headers of the response. The names of the fields of the returned object are those of the headers.

Method:

  • add(name, value) adds a header field with the given name and value.
Type:
  • Object

(static) nextScriptPath :String

Description:
  • Path of script to execute next. Continue processing of the current request by executing the script at nextScriptPath.

Source:

Path of script to execute next. Continue processing of the current request by executing the script at nextScriptPath.

Type:
  • String

(static) previousScriptPath :String

Description:
  • Path of previous script that was executed. Scripts can be chained together by means of the nextScriptPath property. The value of previousScriptPath is the path of the previous script executed or null if no previous script was executed.

Source:

Path of previous script that was executed. Scripts can be chained together by means of the nextScriptPath property. The value of previousScriptPath is the path of the previous script executed or null if no previous script was executed.

Type:
  • String

(static) redirectUrl :String

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

Source:

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

Type:
  • String

(static) statusCode :String

Description:
  • HTML status code (e.g. 200, 301, 401, 403, 500)

Source:

HTML status code (e.g. 200, 301, 401, 403, 500)

Type:
  • String

Methods

(static) write(text)

Description:
  • Write the given text to the body of the response.

Source:
Parameters:
Name Type Description
text String

Text to write to the response.

(static) writeUsingTemplateFile(templateFilePath, data)

Description:
  • 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 Templater.renderFile method, which doesn't write to the response.

Source:
Parameters:
Name Type Description
templateFilePath String

Path to template file.

data Object

Object containing values to substitute into the template.

(static) writeUsingTemplateString(template, data)

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

Source:
Parameters:
Name Type Description
template String
data Object

Object containing values to substitute into the template.