DtoBody.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/protocol/http/outgoing/DtoBody.hpp"

DtoBody

Implementation of oatpp::web::protocol::http::outgoing::Body class.
Extends of oatpp::web::protocol::http::outgoing::ChunkedBufferBody class.
Implements functionality to use DTO Object (see Data Transfer Object (DTO)) as data source for http body.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { 
  class DtoBody : public ChunkedBufferBody {}
}}}}}

Methods

Return Type Name Summary
[none] DtoBody Constructor.
std::shared_ptr<DtoBody> createShared Create shared DtoBody.
void declareHeaders Add Transfer-Encoding: chunked header if chunked option was set to true.

DtoBody::DtoBody

Constructor.

DtoBody(const oatpp::data::mapping::type::AbstractObjectWrapper& dto,
        oatpp::data::mapping::ObjectMapper* objectMapper,
        bool chunked = false)

DtoBody::createShared

Create shared DtoBody.

static std::shared_ptr<DtoBody> createShared(const oatpp::data::mapping::type::AbstractObjectWrapper& dto,
                                             oatpp::data::mapping::ObjectMapper* objectMapper,
                                             bool chunked = false)

DtoBody::declareHeaders

Add Transfer-Encoding: chunked header if chunked option was set to true.
Else, add Content-Length header if chunked option was set to false.

Add Content-Type header depending on oatpp::data::mapping::ObjectMapper used. See oatpp::data::mapping::ObjectMapper::Info.

void declareHeaders(Headers& headers) noexcept override