Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
Response Class Reference

class wrapper of HTTP response More...

#include <response.h>

Inheritance diagram for Response:
Inheritance graph
Collaboration diagram for Response:
Collaboration graph

Public Member Functions

 Response ()
 
 Response (const char *body)
 
 Response (HTTP::Version version, int status, Headers &headers, MessageBody &body)
 
 ~Response ()
 
void setVersion (HTTP::Version version)
 
void setStatus (int status)
 
void setHeaders (Headers &headers)
 
void setBody (MessageBody &body)
 
HTTP::Version getVersion ()
 
int getStatus ()
 
HeadersgetHeaders ()
 
MessageBodygetBody ()
 
void finalize ()
 
bool isFinalized ()
 
void setElapsedTime (std::chrono::duration< double, std::milli > ms)
 
std::chrono::duration< double, std::milli > getElapsedTime ()
 

Detailed Description

class wrapper of HTTP response

Object of this class is representation http response

Constructor & Destructor Documentation

Response::Response ( )

Create empty response with code status 501 and http version HTTP_UNDEFINED

Response::Response ( const char *  body)

Create response with body s MessageBody object and other default params: http version 1.1, ttp response code status 200 and empty headers

Parameters
bodyhttp response body as MessageBody object
Response::Response ( HTTP::Version  version,
int  status,
Headers headers,
MessageBody body 
)

Create response and fill it with declared arguments

Parameters
versionhttp version of response
statushttp response code status
headershttp response headers as Headers object
bodyhttp response body as MessageBody object
Response::~Response ( )

deletes Headers and MessageBody objects

Member Function Documentation

void Response::finalize ( )
MessageBody* Response::getBody ( )

get body of http response

Returns
http response body as MessageBody object
std::chrono::duration<double, std::milli> Response::getElapsedTime ( )
Returns
Headers* Response::getHeaders ( )

get headers of http response

Returns
http response headers as Headers object
int Response::getStatus ( )

get http code status of response

Returns
http response code status
HTTP::Version Response::getVersion ( )

get http version of response

Returns
http response version
bool Response::isFinalized ( )
Returns
void Response::setBody ( MessageBody body)

Set to response MessageBody object and deleting previous one

Parameters
bodyMessageBody object
void Response::setElapsedTime ( std::chrono::duration< double, std::milli >  ms)
Parameters
ms
void Response::setHeaders ( Headers headers)

Set to response Headers object and deleting previous one

Parameters
headersheaders object
void Response::setStatus ( int  status)

Set to response http status

Parameters
statushttp code status
void Response::setVersion ( HTTP::Version  version)

Set to response http version

Parameters
versionvalue of enum HTTP::Version, which represents http version.

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