vibe.d beta banner
get vibe.d
0.8.2

Asynchronous I/O that doesn’t get in your way, written in D

Class HTTPServerResponse

Represents a HTTP response as sent from the server side.

class HTTPServerResponse
  : HTTPResponse ;

Constructors

NameDescription
this

Fields

NameTypeDescription
cookiesCookie[string]All cookies that shall be set on the client for this request
headersDictionaryList!(string,false,12L,false)The response header fields
httpVersionHTTPVersionThe protocol version of the response - should not be changed
statusCodeintThe status code of the response, 200 by default
statusPhrasestringThe status phrase of the response

Properties

NameTypeDescription
bodyWriter[get]OutputStreamA stream for writing the body of the HTTP response.
bytesWritten[get]ulong
connected[get]boolDetermines if the underlying connection is still alive.
headerWritten[get]boolDetermines if the HTTP header has already been written.
timeFinalized[get]std.datetime.SysTimeReturns the time at which the request was finalized.
contentType[get, set]stringShortcut to the "Content-Type" header

Methods

NameDescription
connectProxySpecial method for handling CONNECT proxy tunnel
finalizeFinalizes the response. This is usually called automatically by the server.
isHeadResponseDetermines if the response does not need a body.
redirectSends a redirect request to the client.
setCookieSets the specified cookie value.
startSessionInitiates a new session.
switchProtocolSpecial method sending a SWITCHING_PROTOCOLS response to the client.
terminateSessionTerminates the current session (if any).
tlsDetermines if the response is sent over an encrypted connection.
waitForConnectionCloseWaits until either the connection closes, data arrives, or until the given timeout is reached.
writeBodyWrites the entire response body at once.
writeBodyWrites the entire response body as a single string.
writeJsonBodyWrites a JSON message with the specified status
writePrettyJsonBodyWrites a JSON message with the specified status
writeRawBodyWrites the whole response body at once, without doing any further encoding.
writeVoidBodyWrites the response with no body.
toString
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.