BodyDecoder.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/protocol/http/incoming/BodyDecoder.hpp"

BodyDecoder

Abstract BodyDecoder. Body Decoder is responsible to decode body of incoming request. For example if you receive chunked-encoded body, you have to decode it in order to get "plain" body. You may extend this class in order to customize body-decoding process.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace incoming { 
  class BodyDecoder {}
}}}}}

Methods

Return Type Name Summary
[none] ~BodyDecoder Virtual destructor.
void decode Implement this method! Decode bodyStream and write decoded data to toStream.
oatpp::async::CoroutineStarter decodeAsync Implement this method! Same as BodyDecoder::decode() but Async.
oatpp::String decodeToString Read body stream and decode it to string.
Type::ObjectWrapper decodeToDto Read body stream, decode, and deserialize it as DTO Object (see Data Transfer Object (DTO)).
oatpp::async::CoroutineStarterForResult<const oatpp::String&> decodeToStringAsync Same as BodyDecoder::decodeToString() but Async.
oatpp::async::CoroutineStarterForResult<const typenameDtoType::ObjectWrapper&> decodeToDtoAsync Same as BodyDecoder::decodeToDto() but Async.

BodyDecoder::~BodyDecoder

Virtual destructor.

virtual ~BodyDecoder() = default

BodyDecoder::decode

Implement this method! Decode bodyStream and write decoded data to toStream.

virtual void decode(const Headers& headers,
                    const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
                    const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const = 0

BodyDecoder::decodeAsync

Implement this method! Same as BodyDecoder::decode() but Async.

virtual oatpp::async::CoroutineStarter decodeAsync(const Headers& headers,
                                                   const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
                                                   const std::shared_ptr<oatpp::data::stream::OutputStream>& toStream) const = 0

BodyDecoder::decodeToString

Read body stream and decode it to string.

oatpp::String decodeToString(const Headers& headers,
                             const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream) const

BodyDecoder::decodeToDto

Read body stream, decode, and deserialize it as DTO Object (see Data Transfer Object (DTO)).

template<class Type>
typename Type::ObjectWrapper decodeToDto(const Headers& headers,
                                         const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
                                         const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const

BodyDecoder::decodeToStringAsync

Same as BodyDecoder::decodeToString() but Async.

oatpp::async::CoroutineStarterForResult<const oatpp::String&>
decodeToStringAsync(const Headers& headers, const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream) const

BodyDecoder::decodeToDtoAsync

Same as BodyDecoder::decodeToDto() but Async.

template<class DtoType>
oatpp::async::CoroutineStarterForResult<const typename DtoType::ObjectWrapper&>
decodeToDtoAsync(const Headers& headers,
                 const std::shared_ptr<oatpp::data::stream::InputStream>& bodyStream,
                 const std::shared_ptr<oatpp::data::mapping::ObjectMapper>& objectMapper) const