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.
void decodeToStream Decode using oatpp::data::stream::DefaultWriteCallback.
oatpp::async::CoroutineStarter decodeAsync Implement this method! Same as BodyDecoder::decode() but Async.
oatpp::async::CoroutineStarter decodeToStreamAsync Decode in asynchronous manner using oatpp::data::stream::DefaultAsyncWriteCallback.
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, data::stream::InputStream* bodyStream, data::stream::WriteCallback* writeCallback) const = 0

BodyDecoder::decodeToStream

Decode using oatpp::data::stream::DefaultWriteCallback.

void decodeToStream(const Headers& headers, data::stream::InputStream* bodyStream, data::stream::OutputStream* toStream) const

BodyDecoder::decodeAsync

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

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

BodyDecoder::decodeToStreamAsync

Decode in asynchronous manner using oatpp::data::stream::DefaultAsyncWriteCallback.

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

BodyDecoder::decodeToString

Read body stream and decode it to string.

oatpp::String decodeToString(const Headers& headers, 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,
                                         data::stream::InputStream* bodyStream,
                                         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<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<data::stream::InputStream>& bodyStream,
                 const std::shared_ptr<data::mapping::ObjectMapper>& objectMapper) const