#include <src/rest/response.hpp>
This class implements a response class for OTBR_REST, it could be manipulated by connection instance and resource handler.
◆ Response()
otbr::rest::Response::Response |
( |
void |
| ) |
|
The constructor to initialize a response instance.
◆ GetBody()
std::string otbr::rest::Response::GetBody |
( |
void |
| ) |
const |
This method return a string contains the body field of this response.
- Returns
- A string containing the body field.
◆ GetStartTime()
steady_clock::time_point otbr::rest::Response::GetStartTime |
( |
| ) |
const |
This method returns a timestamp of start time.
- Returns
- A timepoint object indicates start time.
◆ IsComplete()
bool otbr::rest::Response::IsComplete |
( |
| ) |
|
This method checks whether this response is ready to be written to buffer.
- Returns
- A bool value indicates whether this response is ready to be written to buffer..
◆ NeedCallback()
bool otbr::rest::Response::NeedCallback |
( |
void |
| ) |
|
This method checks whether this response need to be processed by callback handler later.
- Returns
- A bool value indicates whether this response need to be processed by callback handler later.
◆ Serialize()
std::string otbr::rest::Response::Serialize |
( |
void |
| ) |
const |
This method serialize a response to a string that could be sent by socket later.
- Returns
- A string contains status line, headers and body of a response.
◆ SetBody()
void otbr::rest::Response::SetBody |
( |
std::string & |
aBody | ) |
|
This method set the response body.
- Parameters
-
[in] | aBody | A string to be set as response body. |
◆ SetCallback()
void otbr::rest::Response::SetCallback |
( |
void |
| ) |
|
This method labels the response as need callback.
◆ SetComplete()
void otbr::rest::Response::SetComplete |
( |
| ) |
|
This method labels the response as complete which means all fields has been successfully set.
◆ SetResponsCode()
void otbr::rest::Response::SetResponsCode |
( |
std::string & |
aCode | ) |
|
This method set the response code.
- Parameters
-
[in] | aCode | A string representing response code such as "404 not found". |
◆ SetStartTime()
void otbr::rest::Response::SetStartTime |
( |
steady_clock::time_point |
aStartTime | ) |
|
This method is used to set a timestamp. when a callback is needed and this field tells callback handler when to collect all the data and form the response.
- Parameters
-
[in] | aStartTime | A timestamp indicates when the response start to wait for callback. |
The documentation for this class was generated from the following files: