Fork me on GitHub Fork me on GitHub

response


<%
    response.addHeader("custom-header", "jaggery_response");
    print("Hello World");
%>

Overview

Object that provides the properties and functions of HTTP Response.


Members

Member Type Description
statusString
response.status
Sets the Status code
contentTypeString
response.contentType = 'application/x-www-form-urlencoded'
Sets response content type
characterEncodingString
response.characterEncoding = 'UTF-8'
Sets response character encoding
contentString | Object | XML
response.content = { products : ["Jaggery", "ESB"] };
response.content = "My response content";

Sets response content

If any thing other than Strings are assigned, then they will be automatically serialized.

Operations

Operation Returns Description
addHeader(key, value) String
response.addHeader('custom-header', 'jaggery_response')
Adding a header to the response
sendRedirect(url) None
response.sendRedirect(url)
Redirect via response
sendError(errCode) None
response.sendError(errCode)
Send an error code
addCookie(cookie) None
var cookie= {'name':'test','value':'Cookie testing'};
response.addCookie(cookie)

Adds the specified cookie to the response.