Class HTTPServerResponse
Represents a HTTP response as sent from the server side.
Inherits from
-
HTTPResponse
(base class)
Constructors
Name | Description |
---|---|
this
|
Fields
Name | Type | Description |
---|---|---|
cookies
|
Cookie[string] |
All cookies that shall be set on the client for this request
|
headers
|
DictionaryList!(string,false,12L,false) |
The response header fields |
httpVersion
|
HTTPVersion |
The protocol version of the response - should not be changed |
statusCode
|
int |
The status code of the response, 200 by default |
statusPhrase
|
string |
The status phrase of the response |
Properties
Name | Type | Description |
---|---|---|
bodyWriter
[get]
|
OutputStream |
A stream for writing the body of the HTTP response. |
bytesWritten
[get]
|
ulong |
|
headerWritten
[get]
|
bool |
Determines if the HTTP header has already been written. |
timeFinalized
[get]
|
std |
Returns the time at which the request was finalized. |
contentType
[get, set]
|
string |
Shortcut to the "Content-Type" header |
Methods
Name | Description |
---|---|
finalize
|
Finalizes the response. This is usually called automatically by the server. |
isHeadResponse
|
Determines if the response does not need a body. |
redirect
|
Sends a redirect request to the client.
|
renderCompat
|
Deprecated - use render instead.
|
setCookie
|
Sets the specified cookie value .
|
startSession
|
Initiates a new session. |
switchProtocol
|
Special method sending a SWITCHING_PROTOCOLS response to the client. |
terminateSession
|
Terminates the current session (if any). |
tls
|
Determines if the response is sent over an encrypted connection. |
waitForConnectionClose
|
Waits until either the connection closes or until the given timeout is
reached.
|
writeBody
|
Writes the entire response body at once. |
writeJsonBody
|
Writes a JSON message with the specified status
|
writeRawBody
|
Writes the whole response body at once, without doing any further encoding. |
writeVoidBody
|
Writes the response with no body. |
toString
|
Aliases
Name | Description |
---|---|
ssl
|
Compatibility alias - use tls instead.
|
Authors
Sönke Ludwig, Jan Krüger, Ilya Shipunov
Copyright
© 2012-2013 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.