BMA Server Framework
Public Types | Public Member Functions | List of all members
BMAResponse Class Reference

#include <BMAResponse.h>

Inheritance diagram for BMAResponse:
Inheritance graph
[legend]
Collaboration diagram for BMAResponse:
Collaboration graph
[legend]

Public Types

enum  Mode { LENGTH, STREAMING }
 

Public Member Functions

 BMAResponse ()
 
 ~BMAResponse ()
 
std::string getResponse (Mode mode)
 
std::string getResponse (std::string content, Mode mode)
 
void setProtocol (std::string protocol)
 
void setCode (std::string code)
 
void setText (std::string text)
 
void setMimeType (std::string mimeType)
 
void addHeaderItem (std::string key, std::string value)
 

Additional Inherited Members

- Public Attributes inherited from BMAObject
std::string name
 
std::string tag
 

Detailed Description

BMAResponse

Use this object to build a response output for a protocol that uses headers and responses as the main communications protocol.

Constructor & Destructor Documentation

◆ BMAResponse()

BMAResponse::BMAResponse ( )

The constructor for the object.

◆ ~BMAResponse()

BMAResponse::~BMAResponse ( )

The destructor for the object.

Member Function Documentation

◆ getResponse() [1/2]

std::string BMAResponse::getResponse ( Mode  mode)

Returns the response generated from the contained values that do not return a content length. Using this constructor ensures a zero length Content-Length value.

Returns
the complete response string to send to client.

◆ getResponse() [2/2]

std::string BMAResponse::getResponse ( std::string  content,
Mode  mode 
)

Returns the response plus the content passed as a parameter.

This method will automatically generate the proper Content-Length value for the response.

Parameters
contentthe content that will be provided on the response message to the client.
Returns
the complete response string to send to client.

◆ setCode()

void BMAResponse::setCode ( std::string  code)

Sets the return code value for the response.

Parameters
codethe response code value to return in the response.

◆ setMimeType()

void BMAResponse::setMimeType ( std::string  mimeType)

Specifies the type of data that will be returned in this response.

Parameters
mimeTypethe mime type for the data.

◆ setProtocol()

void BMAResponse::setProtocol ( std::string  protocol)

Sets the protocol value for the response message. The protocol should match the header received.

Parameters
protocolthe protocol value to return in response.

◆ setText()

void BMAResponse::setText ( std::string  text)

Sets the return code string value for the response.

Parameters
textthe text value for the response code to return on the response.

The documentation for this class was generated from the following files: