#include <RemoteViz/Rendering/HTTPResponse.h>
Public Member Functions | |
HTTPResponse () | |
Creates a HTTP/1.1 response with "200 OK" status. | |
HTTPResponse (HTTPStatus statusCode) | |
Creates a HTTP/1.1 response with the given status and a standard reason phrase. | |
HTTPResponse (HTTPStatus statusCode, const std::string &reason) | |
Creates a HTTP/1.1 response with the given status and reason phrase. | |
HTTPResponse (HTTPStatus statusCode, const std::string &reason, const std::string &body) | |
Creates a HTTP/1.1 response with the given status, reason phrase and message body data. | |
HTTPResponse (HTTPStatus statusCode, const std::string &reason, const std::string &body, int versionMajor, int versionMinor, const HTTPHeaders &headers) | |
Creates a HTTP response with the given status, reason phrase, message body data, version and headers. | |
HTTPResponse (const HTTPResponse &obj) | |
Copy constructor. | |
HTTPResponse & | operator= (const HTTPResponse &obj) |
Copy assignment operator. | |
~HTTPResponse () | |
Destructor. | |
HTTPStatus | getStatusCode () const |
Returns the HTTP status. | |
const std::string & | getReason () const |
Returns the HTTP reason phrase. | |
const std::string & | getBody () const |
Returns the HTTP message body data (optional). | |
int64_t | getContentLength () const |
Returns the size of the body, in bytes (Content-Length entity header) | |
const HTTPHeaders & | getHeaders () const |
Returns HTTP headers. | |
const std::string & | getVersion () const |
Returns the HTTP version for incoming request (example "HTTP/1.1"). | |
int | getVersionMajor () const |
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol. | |
int | getVersionMinor () const |
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol. | |
Static Public Member Functions | |
static std::string | getReasonPhrase (HTTPStatus status) |
Returns the standard HTTP reason phrase for a HTTP status code. | |
This class encapsulates an HTTP response message.
Used in the ServiceListener onHTTPRequest() method.
Definition at line 49 of file HTTPResponse.h.
Enum for the HTTP status codes.
Definition at line 56 of file HTTPResponse.h.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | ) |
Creates a HTTP/1.1 response with "200 OK" status.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | HTTPStatus | statusCode | ) |
Creates a HTTP/1.1 response with the given status and a standard reason phrase.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | HTTPStatus | statusCode, |
const std::string & | reason ) |
Creates a HTTP/1.1 response with the given status and reason phrase.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | HTTPStatus | statusCode, |
const std::string & | reason, | ||
const std::string & | body ) |
Creates a HTTP/1.1 response with the given status, reason phrase and message body data.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | HTTPStatus | statusCode, |
const std::string & | reason, | ||
const std::string & | body, | ||
int | versionMajor, | ||
int | versionMinor, | ||
const HTTPHeaders & | headers ) |
Creates a HTTP response with the given status, reason phrase, message body data, version and headers.
RemoteViz::Rendering::HTTPResponse::HTTPResponse | ( | const HTTPResponse & | obj | ) |
Copy constructor.
RemoteViz::Rendering::HTTPResponse::~HTTPResponse | ( | ) |
Destructor.
const std::string & RemoteViz::Rendering::HTTPResponse::getBody | ( | ) | const |
Returns the HTTP message body data (optional).
Returns an empty string if the response does not have a body message.
int64_t RemoteViz::Rendering::HTTPResponse::getContentLength | ( | ) | const |
Returns the size of the body, in bytes (Content-Length entity header)
const HTTPHeaders & RemoteViz::Rendering::HTTPResponse::getHeaders | ( | ) | const |
Returns HTTP headers.
const std::string & RemoteViz::Rendering::HTTPResponse::getReason | ( | ) | const |
Returns the HTTP reason phrase.
|
static |
Returns the standard HTTP reason phrase for a HTTP status code.
HTTPStatus RemoteViz::Rendering::HTTPResponse::getStatusCode | ( | ) | const |
Returns the HTTP status.
const std::string & RemoteViz::Rendering::HTTPResponse::getVersion | ( | ) | const |
Returns the HTTP version for incoming request (example "HTTP/1.1").
int RemoteViz::Rendering::HTTPResponse::getVersionMajor | ( | ) | const |
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.
Returns the version major.
int RemoteViz::Rendering::HTTPResponse::getVersionMinor | ( | ) | const |
HTTP uses a "major.minor" numbering scheme to indicate versions of the protocol.
Returns the version minor.
HTTPResponse & RemoteViz::Rendering::HTTPResponse::operator= | ( | const HTTPResponse & | obj | ) |
Copy assignment operator.