WispRes
Slots
-
internal Void checkUncommitted()
If the response has already been committed, then throw an Err.
-
internal Void close()
This method is called to close down the response. We ensure the response is committed and if we have a response output stream we close it to flush the content body.
-
internal Void commit(Bool content)
If we haven't committed yet, then write the response header. The content flag specifies whether this response will have a content body in the response.
-
override Cookie[] cookies := Cookie[,]
Overrides web::WebRes.cookies
Get the list of cookies to set via a header fields. Add a a Cookie to this list to set a cookie. Once the response is commited, this list becomes readonly.
- doneSource
-
override Void done()
Overrides web::WebRes.done
Done is called to indicate that that response is complete to terminate pipeline processing. Once called, no further WebSteps in the pipeline are executed.
- headersSource
-
override Str:Str headers := [Str:Str][:]
Overrides web::WebRes.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.
- isCommittedSource
-
override readonly Bool isCommitted := false
Overrides web::WebRes.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.
- isDoneSource
-
override readonly Bool isDone := false
Overrides web::WebRes.isDone
Return if this response is complete - see done.
- makeSource
-
new make(WispService service, TcpSocket socket)
- outSource
-
override WebOutStream out()
Overrides web::WebRes.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. If the "Content-Length" header defines a fixed number of bytes, then attemps to write too many bytes will throw an IOErr. If "Content-Length" is not defined, then a chunked transfer encoding is automatically used.
- redirectSource
-
override Void redirect(Uri uri, Int statusCode := 303)
Overrides web::WebRes.redirect
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.
- sendErrorSource
-
override Void sendError(Int statusCode, Str? msg := null)
Overrides web::WebRes.sendError
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.
- serviceSource
-
override WispService service
Overrides web::WebRes.service
WispService.
-
internal TcpSocket socket
- statusCodeSource
-
override Int statusCode := 200
Overrides web::WebRes.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.
-
internal WebOutStream? webOut