Jaxer.Response

Current response and its associated information.

Constructor

An instance of this class is accessible globally from any Server side code under the namespace Jaxer.response.

Properties

  • Jaxer.response.headers
  • A collection of the HTTP response headers that will be returned to the browser, as properties on this simple JavaScript object. If multiple headers have the same name, their values are given as an array. NOTE: some headers are set by the web server after Jaxer is done, and they will not appear here.

  • Jaxer.response.reasonPhrase
  • Gets the string description of the HTTP status code for the request.

  • Jaxer.response.statusCode
  • Gets the integer value of the HTTP status code for the request.

    Methods

  • Jaxer.response.addHeader(name, value);
    • <String> name - The name of the HTTP header
    • <String> value - The value to use

    null

    Adds an HTTP header to the response. If an existing header with this name exists, this value will be appended.

  • Jaxer.response.exit([statusCode], [contents], [reasonPhrase]);
    • <Number> statusCode - (optional)The HTTP status code to return to the browser
    • <String> contents - (optional)The contents to use for the body of the response
    • <String> reasonPhrase - (optional)The text description (e.g. "OK") of the status code

    null

    Stops processing the current request's HTML page and JavaScript, and returns this response to the browser via the web server. If contents is null or undefined, and setContents has not been called on this response, the current DOM will be serialized and returned as the response contents. If this is an XMLDocument or an E4X XML object, its string representation will be used, and a Content-Type header of "application/xml" will be returned (unless a Content-Type header was already specified in this response).

  • Jaxer.response.redirect(url, [statusCode], [reasonPhrase]);
    • <String> url - The URL to which the browser should redirect the request
    • <Number> statusCode - (optional)The HTTP status code to return to the browser
    • <String> reasonPhrase - (optional)The text description of the status code

    null

    Stops processing the current request's HTML page and JavaScript, and returns a redirect-type HTTP response to the browser. No contents (response body) are returned to the browser, and the DOM is not serialized.