#include <icy/http/response.h>Inherits:
Message
HTTP response message with status, reason phrase, headers, and body metadata.
| Return | Name | Description |
|---|---|---|
Response | Creates the Response with OK status. | |
Response | Creates the Response with the given status and reason phrase. | |
Response | Creates the Response with the given version, status and reason phrase. | |
Response | Creates the Response with the given status and an appropriate reason phrase. | |
Response | Creates the Response with the given version, status and an appropriate reason phrase. | |
~Response virtual | Destroys the Response. | |
void | setStatus | Sets the HTTP status code. |
StatusCode | getStatus const | Returns the HTTP status code. |
void | setReason | Sets the HTTP reason phrase. |
const std::string & | getReason const | Returns the HTTP reason phrase. |
void | setStatusAndReason | Sets the HTTP status code and reason phrase. |
void | setDate | Sets the Date header to the given date/time value. |
Timestamp | getDate const | Returns the value of the Date header. |
void | addCookie | Adds the cookie to the response by adding a Set-Cookie header. |
void | getCookies const | Returns a vector with all the cookies set in the response header. |
void | write virtual const | Writes the HTTP response headers to the given output stream. |
void | write virtual const | Writes the HTTP response headers to the given output string. |
void | write virtual const | Writes the HTTP response headers directly into a byte buffer. |
bool | success virtual const | Returns true if the HTTP response code was successful (< 400). |
Response()Creates the Response with OK status.
Response(StatusCode status, const std::string & reason)Creates the Response with the given status and reason phrase.
Response(const std::string & version, StatusCode status, const std::string & reason)Creates the Response with the given version, status and reason phrase.
Response(StatusCode status)Creates the Response with the given status and an appropriate reason phrase.
Response(const std::string & version, StatusCode status)Creates the Response with the given version, status and an appropriate reason phrase.
virtual
virtual ~Response()Destroys the Response.
void setStatus(StatusCode status)Sets the HTTP status code.
The reason phrase is set according to the status code.
const
StatusCode getStatus() constReturns the HTTP status code.
void setReason(const std::string & reason)Sets the HTTP reason phrase.
const
const std::string & getReason() constReturns the HTTP reason phrase.
void setStatusAndReason(StatusCode status, const std::string & reason)Sets the HTTP status code and reason phrase.
void setDate(const Timestamp & dateTime)Sets the Date header to the given date/time value.
const
Timestamp getDate() constReturns the value of the Date header.
void addCookie(const Cookie & cookie)Adds the cookie to the response by adding a Set-Cookie header.
const
void getCookies(std::vector< Cookie > & cookies) constReturns a vector with all the cookies set in the response header.
May throw an exception in case of a malformed Set-Cookie header.
virtual const
virtual void write(std::ostream & ostr) constWrites the HTTP response headers to the given output stream.
virtual const
virtual void write(std::string & str) constWrites the HTTP response headers to the given output string.
virtual const
virtual void write(Buffer & buf) constWrites the HTTP response headers directly into a byte buffer.
virtual const
virtual bool success() constReturns true if the HTTP response code was successful (< 400).
StatusCode _statusstd::string _reason