C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
|
Base class for HTTP messages. This class is to store common functionality so it isn't duplicated on both the request and response side. More...
#include <http_msg.h>
Public Member Functions | |
http_headers & | headers () |
_ASYNCRTIMP void | set_body (const concurrency::streams::istream &instream, const utf8string &contentType) |
_ASYNCRTIMP void | set_body (const concurrency::streams::istream &instream, const utf16string &contentType) |
_ASYNCRTIMP void | set_body (const concurrency::streams::istream &instream, utility::size64_t contentLength, const utf8string &contentType) |
_ASYNCRTIMP void | set_body (const concurrency::streams::istream &instream, utility::size64_t contentLength, const utf16string &contentType) |
utility::string_t | parse_and_check_content_type (bool ignore_content_type, const std::function< bool(const utility::string_t &)> &check_content_type) |
Helper function for extract functions. Parses the Content-Type header and check to make sure it matches, throws an exception if not. More... | |
_ASYNCRTIMP utf8string | extract_utf8string (bool ignore_content_type=false) |
_ASYNCRTIMP utf16string | extract_utf16string (bool ignore_content_type=false) |
_ASYNCRTIMP utility::string_t | extract_string (bool ignore_content_type=false) |
_ASYNCRTIMP json::value | _extract_json (bool ignore_content_type=false) |
_ASYNCRTIMP std::vector< unsigned char > | _extract_vector () |
virtual _ASYNCRTIMP utility::string_t | to_string () const |
virtual _ASYNCRTIMP void | _complete (utility::size64_t bodySize, const std::exception_ptr &exceptionPtr=std::exception_ptr()) |
Completes this message More... | |
void | set_instream (const concurrency::streams::istream &instream) |
Set the stream through which the message body could be read More... | |
const concurrency::streams::istream & | instream () const |
Get the stream through which the message body could be read More... | |
void | set_outstream (const concurrency::streams::ostream &outstream, bool is_default) |
Set the stream through which the message body could be written More... | |
const concurrency::streams::ostream & | outstream () const |
Get the stream through which the message body could be written More... | |
const pplx::task_completion_event< utility::size64_t > & | _get_data_available () const |
_ASYNCRTIMP void | _prepare_to_receive_data () |
Prepare the message with an output stream to receive network data More... | |
_ASYNCRTIMP size_t | _get_content_length () |
Determine the content length More... | |
Protected Attributes | |
concurrency::streams::istream | m_inStream |
Stream to read the message body. By default this is an invalid stream. The user could set the instream on a request by calling set_request_stream(...). This would also be set when set_body() is called - a stream from the body is constructed and set. Even in the presense of msg body this stream could be invalid. An example would be when the user sets an ostream for the response. With that API the user does not provide the ability to read the msg body. Thus m_instream is valid when there is a msg body and it can actually be read More... | |
concurrency::streams::ostream | m_outStream |
stream to write the msg body By default this is an invalid stream. The user could set this on the response (for http_client). In all the other cases we would construct one to transfer the data from the network into the message body. More... | |
http_headers | m_headers |
bool | m_default_outstream |
pplx::task_completion_event< utility::size64_t > | m_data_available |
The TCE is used to signal the availability of the message body. More... | |
Friends | |
class | http::client::http_client |
Base class for HTTP messages. This class is to store common functionality so it isn't duplicated on both the request and response side.
|
virtual |
Completes this message
_ASYNCRTIMP size_t web::http::details::http_msg_base::_get_content_length | ( | ) |
Determine the content length
This routine should only be called after a msg (request/response) has been completely constructed.
_ASYNCRTIMP void web::http::details::http_msg_base::_prepare_to_receive_data | ( | ) |
Prepare the message with an output stream to receive network data
|
inline |
Get the stream through which the message body could be read
|
inline |
Get the stream through which the message body could be written
utility::string_t web::http::details::http_msg_base::parse_and_check_content_type | ( | bool | ignore_content_type, |
const std::function< bool(const utility::string_t &)> & | check_content_type | ||
) |
Helper function for extract functions. Parses the Content-Type header and check to make sure it matches, throws an exception if not.
ignore_content_type | If true ignores the Content-Type header value. |
check_content_type | Function to verify additional information on Content-Type. |
|
inline |
Set the stream through which the message body could be read
|
inline |
Set the stream through which the message body could be written
|
protected |
The TCE is used to signal the availability of the message body.
|
protected |
Stream to read the message body. By default this is an invalid stream. The user could set the instream on a request by calling set_request_stream(...). This would also be set when set_body() is called - a stream from the body is constructed and set. Even in the presense of msg body this stream could be invalid. An example would be when the user sets an ostream for the response. With that API the user does not provide the ability to read the msg body. Thus m_instream is valid when there is a msg body and it can actually be read
|
protected |
stream to write the msg body By default this is an invalid stream. The user could set this on the response (for http_client). In all the other cases we would construct one to transfer the data from the network into the message body.