Response interface represents an HTTP response.
Constructed by the Platform when a plugin handles a request, available through the
response property of the
Object for the response headers, acting as a dictionary.
The HTTP status code for the result. Use the constants defined in the
The body of the response. Set to a
Alternatively, set this property to
BinaryData (eg generated files) or
File objects. In these cases, appropriate headers will be added for the
Content-Type and the download filename.
As an alternative to setting the
Content-Type, set this property to the kind of response. Possible values are
Content-Type headers will include the UTF-8 charset option.
Content-Type header set using the
headers property will override the header implied by the
Sets this response to a HTTP redirect.
function setBackLink(url, text)
The standard HTML ‘chrome’ for a page includes an option link in the top left, which is used as a link back to the previous page. Use this to set the url path and, optionally, the text if you don’t want it to read “Back”.
This may more easily be set with the
backLinkText keys in the view for the
static directory. This will output a
<link> tag based on the extension of the file.
The resource name is the filename, without any path, for example,
If you need to include a static resource in a response which is not being generated by your plugin, use the std:plugin:resources() template function, and render the template, discarding the HTML it returns.
Set the expiry time of the response, specified as seconds into the future. This will set the
Expires headers of the response.