const classafBedSheet::HttpResponseHeaders
sys::Obj afBedSheet::HttpResponseHeaders
A wrapper for HTTP response headers with accessors for commonly used headings.
@see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- cacheControl
Str? cacheControl
Tells all caching mechanisms from server to client whether they may cache this object. It is measured in seconds.
Example:
Cache-Control: max-age=3600
- contentDisposition
Str? contentDisposition
Usually used to direct the client to display a
save as
dialog.Example:
Content-Disposition: Attachment; filename=example.html
- contentEncoding
Str? contentEncoding
The type of encoding used on the data.
Example:
Content-Encoding: gzip
- contentLength
Int? contentLength
The length of the response body in octets (8-bit bytes).
Example:
Content-Length: 348
- contentType
MimeType? contentType
The MIME type of this content.
Example:
Content-Type: text/html; charset=utf-8
- eTag
Str? eTag
An identifier for a specific version of a resource, often a message digest.
Example:
ETag: "737060cd8c284d8af7ad3082f209582d"
- expires
DateTime? expires
Gives the date/time after which the response is considered stale.
Example:
Expires: Thu, 01 Dec 1994 16:00:00 GMT
- get
Returns the named response header.
- lastModified
DateTime? lastModified
The last modified date for the requested object, in RFC 2822 format.
Example:
Last-Modified: Tue, 15 Nov 1994 12:45:26 +0000
- location
Uri? location
Used in redirection, or when a new resource has been created.
Example:
Location: http://www.w3.org/pub/WWW/People.html
- map
Returns a read / write map of the response headers.
It is better to use
set()
/remove()
/ or one of the setters on thisHttpResponseHeaders
instance to change response values. This allows us to check if the response has already been committed before updating header values.Think of this
map
as a get-out-jail card.- pragma
Str? pragma
Implementation-specific headers.
Example:
Pragma: no-cache
- remove
Removes a response header.
- set
@
Operator
Void set(Str name, Str? value)Sets a response head to the given value.
If the given value is
null
then it is removed.- vary
Str? vary
Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server.
Example:
Vary: Accept-Encoding
- wwwAuthenticate
Str? wwwAuthenticate
WWW-Authenticate header to indicate supported authentication mechanisms.
Example:
WWW-Authenticate: SCRAM hash=SHA-256
Returns
null
if the header doesn't exist.- xFrameOptions
Str? xFrameOptions
Clickjacking protection, set to:
deny
- no rendering within a frame,sameorigin
- no rendering if origin mismatch
Example:
X-Frame-Options: deny
- xXssProtection
Str? xXssProtection
Cross-site scripting (XSS) filter.
Example:
X-XSS-Protection: 1; mode=block