
WebRes encapsulates a response to a web request.
Slots
- headers
-
abstract Str:Str headers()
Map of HTTP response headers. You must set all headers before you access out() for the first time, which commits the response. After the response is commited this map becomes read only.
- isCommitted
-
abstract Bool isCommitted()
Return true if this response has been commmited. A committed response has written its response headers, and can no longer modify its status code or headers. A response is committed the first time that out is called.
- out
-
abstract WebOutStream out()
Return the WebOutStream for this response. The first time this method is accessed the response is committed: all headers currently set will be written to the stream, and can no longer be modified.
- redirect
-
abstract Void redirect(Int statusCode, Uri uri)
Send a redirect response to the client using the specified status code and url. If this response has already been committed this method throws an Err.
- sendError
-
abstract Void sendError(Int statusCode, Str msg := def)
Send an error response to client using the specified status and HTML formatted message. If this response has already been committed this method throws an Err. If the server has a preconfigured page for this error code, it will trump the message passed in.
- service
-
abstract WebService service()
Get the WebService managing the request.
- statusCode
-
abstract Int statusCode
Get or set the HTTP status code for this response. Status code defaults to 200. If response has already been committed, throws Err. If status code passed in is not recognized, throws Err.
- statusMsg
-
static Int:Str statusMsg
Map of HTTP status codes to status messages.