Response
Response
#include <icy/http/response.h>class ResponseDefined in src/http/include/icy/http/response.h:78
Inherits:
Message
HTTP response message with status, reason phrase, headers, and body metadata.
List of all members
| Name | Kind | Owner |
|---|---|---|
operator<< | friend | Declared here |
Response | function | Declared here |
Response | function | Declared here |
Response | function | Declared here |
Response | function | Declared here |
Response | function | Declared here |
~Response | function | Declared here |
setStatus | function | Declared here |
getStatus | function | Declared here |
setReason | function | Declared here |
getReason | function | Declared here |
setStatusAndReason | function | Declared here |
setDate | function | Declared here |
getDate | function | Declared here |
addCookie | function | Declared here |
getCookies | function | Declared here |
write | function | Declared here |
write | function | Declared here |
write | function | Declared here |
success | function | Declared here |
_status | variable | Declared here |
_reason | variable | Declared here |
setVersion | function | Inherited from Message |
getVersion | function | Inherited from Message |
setContentLength | function | Inherited from Message |
getContentLength | function | Inherited from Message |
hasContentLength | function | Inherited from Message |
setTransferEncoding | function | Inherited from Message |
getTransferEncoding | function | Inherited from Message |
setChunkedTransferEncoding | function | Inherited from Message |
isChunkedTransferEncoding | function | Inherited from Message |
setContentType | function | Inherited from Message |
getContentType | function | Inherited from Message |
setKeepAlive | function | Inherited from Message |
getKeepAlive | function | Inherited from Message |
write | function | Inherited from Message |
write | function | Inherited from Message |
write | function | Inherited from Message |
HTTP_1_0 | variable | Inherited from Message |
HTTP_1_1 | variable | Inherited from Message |
IDENTITY_TRANSFER_ENCODING | variable | Inherited from Message |
CHUNKED_TRANSFER_ENCODING | variable | Inherited from Message |
UNKNOWN_CONTENT_LENGTH | variable | Inherited from Message |
UNKNOWN_CONTENT_TYPE | variable | Inherited from Message |
CONTENT_LENGTH | variable | Inherited from Message |
CONTENT_TYPE | variable | Inherited from Message |
TRANSFER_ENCODING | variable | Inherited from Message |
CONNECTION | variable | Inherited from Message |
CONNECTION_KEEP_ALIVE | variable | Inherited from Message |
CONNECTION_CLOSE | variable | Inherited from Message |
EMPTY | variable | Inherited from Message |
_version | variable | Inherited from Message |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
~Message | function | Inherited from Message |
NVCollection | function | Inherited from NVCollection |
NVCollection | function | Inherited from NVCollection |
NVCollection | function | Inherited from NVCollection |
~NVCollection | function | Inherited from NVCollection |
operator= | function | Inherited from NVCollection |
operator= | function | Inherited from NVCollection |
operator[] | function | Inherited from NVCollection |
set | function | Inherited from NVCollection |
add | function | Inherited from NVCollection |
add | function | Inherited from NVCollection |
get | function | Inherited from NVCollection |
get | function | Inherited from NVCollection |
has | function | Inherited from NVCollection |
find | function | Inherited from NVCollection |
begin | function | Inherited from NVCollection |
end | function | Inherited from NVCollection |
empty | function | Inherited from NVCollection |
size | function | Inherited from NVCollection |
erase | function | Inherited from NVCollection |
clear | function | Inherited from NVCollection |
Map | typedef | Inherited from NVCollection |
Iterator | typedef | Inherited from NVCollection |
ConstIterator | typedef | Inherited from NVCollection |
_map | variable | Inherited from NVCollection |
Inherited from Message
| Kind | Name | Description |
|---|---|---|
function | setVersion | Sets the HTTP version for this message. |
function | getVersion const | Returns the HTTP version for this message. |
function | setContentLength | Sets the Content-Length header. |
function | getContentLength const | Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present. |
function | hasContentLength const | Returns true if a Content-Length header is present. |
function | setTransferEncoding | Sets the transfer encoding for this message. |
function | getTransferEncoding const | Returns the transfer encoding used for this message. |
function | setChunkedTransferEncoding | If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header. |
function | isChunkedTransferEncoding const | Returns true if the Transfer-Encoding header is set and its value is chunked. |
function | setContentType | Sets the content type for this message. |
function | getContentType const | Returns the content type for this message. |
function | setKeepAlive | Sets the value of the Connection header field. |
function | getKeepAlive const | Returns true if |
function | write virtual const | Writes the message header to the given output stream. |
function | write virtual const | Writes the message header to the given output string. |
function | write virtual const | Writes the message header directly into a byte buffer. |
variable | HTTP_1_0 static | |
variable | HTTP_1_1 static | |
variable | IDENTITY_TRANSFER_ENCODING static | |
variable | CHUNKED_TRANSFER_ENCODING static | |
variable | UNKNOWN_CONTENT_LENGTH static | |
variable | UNKNOWN_CONTENT_TYPE static | |
variable | CONTENT_LENGTH static | |
variable | CONTENT_TYPE static | |
variable | TRANSFER_ENCODING static | |
variable | CONNECTION static | |
variable | CONNECTION_KEEP_ALIVE static | |
variable | CONNECTION_CLOSE static | |
variable | EMPTY static | |
variable | _version | |
function | Message | Creates the Message with version HTTP/1.0. |
function | Message | Creates the Message and sets the version. |
function | ~Message virtual | Destroys the Message. |
Inherited from NVCollection
| Kind | Name | Description |
|---|---|---|
function | NVCollection inline | |
function | NVCollection inline | |
function | NVCollection inline noexcept | |
function | ~NVCollection virtual inline | |
function | operator= | Assigns the name-value pairs of another NVCollection to this one. |
function | operator= noexcept | |
function | operator[] const | Returns the value of the (first) name-value pair with the given name. |
function | set | Sets the value of the (first) name-value pair with the given name. |
function | add | Adds a new name-value pair with the given name and value. |
function | add | Adds a new name-value pair using move semantics. |
function | get const | Returns the value of the first name-value pair with the given name. |
function | get const | Returns the value of the first name-value pair with the given name. If no value with the given name has been found, the defaultValue is returned. |
function | has const | Returns true if there is at least one name-value pair with the given name. |
function | find const | Returns an iterator pointing to the first name-value pair with the given name. |
function | begin const | Returns an iterator pointing to the begin of the name-value pair collection. |
function | end const | Returns an iterator pointing to the end of the name-value pair collection. |
function | empty const | Returns true iff the header does not have any content. |
function | size const | Returns the number of name-value pairs in the collection. |
function | erase | Removes all name-value pairs with the given name. |
function | clear | Removes all name-value pairs and their values. |
typedef | Map | |
typedef | Iterator | |
typedef | ConstIterator | |
variable | _map |
Friends
| Name | Description |
|---|---|
operator<< inline |
operator<<
inline
friend inline std::ostream & operator<<(std::ostream & stream, const Response & res)Defined in src/http/include/icy/http/response.h:145
Public Methods
| 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
Response()Defined in src/http/include/icy/http/response.h:82
Creates the Response with OK status.
Response
Response(StatusCode status, const std::string & reason)Defined in src/http/include/icy/http/response.h:85
Creates the Response with the given status and reason phrase.
Response
Response(const std::string & version, StatusCode status, const std::string & reason)Defined in src/http/include/icy/http/response.h:88
Creates the Response with the given version, status and reason phrase.
Response
Response(StatusCode status)Defined in src/http/include/icy/http/response.h:92
Creates the Response with the given status and an appropriate reason phrase.
Response
Response(const std::string & version, StatusCode status)Defined in src/http/include/icy/http/response.h:96
Creates the Response with the given version, status and an appropriate reason phrase.
~Response
virtual
virtual ~Response()Defined in src/http/include/icy/http/response.h:99
Destroys the Response.
setStatus
void setStatus(StatusCode status)Defined in src/http/include/icy/http/response.h:104
Sets the HTTP status code.
The reason phrase is set according to the status code.
getStatus
const
StatusCode getStatus() constDefined in src/http/include/icy/http/response.h:107
Returns the HTTP status code.
setReason
void setReason(const std::string & reason)Defined in src/http/include/icy/http/response.h:110
Sets the HTTP reason phrase.
getReason
const
const std::string & getReason() constDefined in src/http/include/icy/http/response.h:113
Returns the HTTP reason phrase.
setStatusAndReason
void setStatusAndReason(StatusCode status, const std::string & reason)Defined in src/http/include/icy/http/response.h:116
Sets the HTTP status code and reason phrase.
setDate
void setDate(const Timestamp & dateTime)Defined in src/http/include/icy/http/response.h:119
Sets the Date header to the given date/time value.
getDate
const
Timestamp getDate() constDefined in src/http/include/icy/http/response.h:122
Returns the value of the Date header.
addCookie
void addCookie(const Cookie & cookie)Defined in src/http/include/icy/http/response.h:126
Adds the cookie to the response by adding a Set-Cookie header.
getCookies
const
void getCookies(std::vector< Cookie > & cookies) constDefined in src/http/include/icy/http/response.h:131
Returns a vector with all the cookies set in the response header.
May throw an exception in case of a malformed Set-Cookie header.
write
virtual const
virtual void write(std::ostream & ostr) constDefined in src/http/include/icy/http/response.h:134
Writes the HTTP response headers to the given output stream.
Reimplements
write
virtual const
virtual void write(std::string & str) constDefined in src/http/include/icy/http/response.h:137
Writes the HTTP response headers to the given output string.
Reimplements
write
virtual const
virtual void write(Buffer & buf) constDefined in src/http/include/icy/http/response.h:140
Writes the HTTP response headers directly into a byte buffer.
Reimplements
success
virtual const
virtual bool success() constDefined in src/http/include/icy/http/response.h:143
Returns true if the HTTP response code was successful (< 400).
Private Attributes
_status
StatusCode _statusDefined in src/http/include/icy/http/response.h:152
_reason
std::string _reason