SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWHttpRequestBody Class Referenceabstract

Encapsulates reading an HTTP message body. More...

#include <rw/http/RWHttpRequestBody.h>

Inheritance diagram for RWHttpRequestBody:
RWHttpRequestStreamBody RWHttpRequestStringBody

Public Member Functions

 RWHttpRequestBody ()
 
virtual ~RWHttpRequestBody ()
 
virtual RWHttpRequestBodyclone () const =0
 
virtual int getContentLength () const =0
 
virtual RWCString getNextChunk (size_t size)=0
 
virtual bool isValid () const =0
 

Detailed Description

RWHttpRequestBody is an abstract base class from which the methods for handling message bodies are derived.

Constructor & Destructor Documentation

◆ RWHttpRequestBody()

RWHttpRequestBody::RWHttpRequestBody ( )
inline

Constructs a default RWHttpRequestBody object.

◆ ~RWHttpRequestBody()

virtual RWHttpRequestBody::~RWHttpRequestBody ( )
virtual

Virtual destructor.

Member Function Documentation

◆ clone()

virtual RWHttpRequestBody * RWHttpRequestBody::clone ( ) const
pure virtual

A virtual function that creates a polymorphic copy of the object on the heap.

Implemented in RWHttpRequestStreamBody, and RWHttpRequestStringBody.

◆ getContentLength()

virtual int RWHttpRequestBody::getContentLength ( ) const
pure virtual

Returns the total length of the body object, if known. Returns -1 if the Content-Length cannot be determined in the derived class.

Note
An exception is thrown if data without a Content-Length is sent to a server with version less than HTTP/1.1.

Implemented in RWHttpRequestStreamBody, and RWHttpRequestStringBody.

◆ getNextChunk()

virtual RWCString RWHttpRequestBody::getNextChunk ( size_t size)
pure virtual

Reads and returns the next size bytes from the body as an RWCString. If size bytes are not available, the remainder of the string is returned. Returns an empty string when no data is available.

Implemented in RWHttpRequestStreamBody, and RWHttpRequestStringBody.

◆ isValid()

virtual bool RWHttpRequestBody::isValid ( ) const
pure virtual

Returns true if the body is valid, and returns false otherwise. isValid() is virtual, which means that derived classes can define their own isValid() state.

Implemented in RWHttpRequestStreamBody, and RWHttpRequestStringBody.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.