Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# cgicc::HTTPResponseHeader Class Reference

Generic HTTP response header. More...

`#include <cgicc/HTTPResponseHeader.h>`

Inheritance diagram for cgicc::HTTPResponseHeader::

List of all members.

## Public Methods
Constructor and Destructor
| HTTPResponseHeader (const std::string &http_version, int status_code, const std::string &reason_phrase)
| Create a new HTTP response header. More...
virtual | ~HTTPResponseHeader ()
| Delete this HTTPResponseHeader. More...
Additional Header Management
HTTPResponseHeader & | addHeader (const std::string &header)
| Add a general, response, or entity header to this one. More...
HTTPResponseHeader & | addHeader (const std::string &name, const std::string &value)
| Add a general, response, or entity header to this one. More...
const std::vector< std::string > & | getHeaders () const
| Get a list of all additional headers. More...
Cookie Management
HTTPResponseHeader & | setCookie (const HTTPCookie &cookie)
| Set a cookie to go out with this HTTPResponseHeader. More...
const std::vector< HTTPCookie > & | getCookies () const
| Get a list of all cookies associated with this header. More...
Accessor methods
Retrieve information on the header
const std::string & | getHTTPVersion () const
| Get the HTTP version. More...
int | getStatusCode () const
| Get the 3-digit status code. More...
std::string | getReasonPhrase () const
| Get the reason phrase associated with the stats code. More...
Mutator methods
Set information on the header
HTTPResponseHeader & | getHTTPVersion (const std::string &http_version)
| Set the HTTP version. More...
HTTPResponseHeader & | getStatusCode (int status_code)
| Get the 3-digit status code. More...
HTTPResponseHeader & | getReasonPhrase (const std::string &reason_phrase)
| Get the reason phrase associated with the stats code. More...
Inherited Methods
virtual void | render (std::ostream &out) const
| Write this object to a stream. More...

## Detailed Description

Generic HTTP response header.

This class represents an HTTP response header as defined in section 6 of RFC 2616 (see http://www.w3.org)

All HTTP/1.1 reponses consist of an initial status line containing the HTTP version, a 3-digit status code, and a human-readable reason phrase explaining the status code.

The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:

- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received, understood, and accepted
- 3xx: Redirection - Further action must be taken in order to complete the request
- 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently valid request

Definition at line 71 of file HTTPResponseHeader.h.

## Constructor & Destructor Documentation

cgicc::HTTPResponseHeader::HTTPResponseHeader | ( | const std::string & | http_version,
|  | int | status_code,
|  | const std::string & | reason_phrase
| ) |

  | Create a new HTTP response header. Parameters:
  http_version | The HTTP version string, usually `HTTP/1.1`
  status_code | The 3-digit HTTP status code
  reason_phrase | A short textual description of the status code

virtual cgicc::HTTPResponseHeader::~HTTPResponseHeader | ( |  | ) | `[virtual]`

| Delete this HTTPResponseHeader.

## Member Function Documentation

HTTPResponseHeader& cgicc::HTTPResponseHeader::addHeader | ( | const std::string & | name,
|  | const std::string & | value
| ) |

  | Add a general, response, or entity header to this one. Parameters:
  header | The text of the header to add
Returns: A reference to this

HTTPResponseHeader& cgicc::HTTPResponseHeader::addHeader | ( | const std::string & | header | ) |

  | Add a general, response, or entity header to this one. Parameters:
  header | The text of the header to add
Returns: A reference to this

const std:: vector<HTTPCookie>& cgicc::HTTPResponseHeader::getCookies | ( |  | ) | const`[inline]`

| Get a list of all cookies associated with this header. Returns: All the cookies associated with this header Definition at line 144 of file HTTPResponseHeader.h.

const std:: vector< std:: string>& cgicc::HTTPResponseHeader::getHeaders | ( |  | ) | const`[inline]`

| Get a list of all additional headers. Returns: A list of all additional headers Definition at line 125 of file HTTPResponseHeader.h.

HTTPResponseHeader& cgicc::HTTPResponseHeader::getHTTPVersion | ( | const std::string & | http_version | ) | `[inline]`

  | Set the HTTP version. The HTTP version is a string of the form `HTTP/1.1` Parameters:
  http_version | The HTTP version string, usually `HTTP/1.1`
Returns: A reference to this Definition at line 201 of file HTTPResponseHeader.h.

const std:: string& cgicc::HTTPResponseHeader::getHTTPVersion | ( |  | ) | const`[inline]`

| Get the HTTP version. The HTTP version is a string of the form `HTTP/1.1` Returns: The HTTP version Definition at line 162 of file HTTPResponseHeader.h.

HTTPResponseHeader& cgicc::HTTPResponseHeader::getReasonPhrase | ( | const std::string & | reason_phrase | ) | `[inline]`

  | Get the reason phrase associated with the stats code. The reason phrase is a human-readable interpretation of the status code Parameters:
  reason_phrase | A short textual description of the status code
Returns: A reference to this Definition at line 223 of file HTTPResponseHeader.h.

std:: string cgicc::HTTPResponseHeader::getReasonPhrase | ( |  | ) | const`[inline]`

| Get the reason phrase associated with the stats code. The reason phrase is a human-readable interpretation of the status code Returns: The reason phrase Definition at line 182 of file HTTPResponseHeader.h.

HTTPResponseHeader& cgicc::HTTPResponseHeader::getStatusCode | ( | int | status_code | ) | `[inline]`

  | Get the 3-digit status code. The 3-digit status code indicates the disposition of the response. Parameters:
  status_code | The 3-digit HTTP status code
Returns: A reference to this Definition at line 212 of file HTTPResponseHeader.h.

int cgicc::HTTPResponseHeader::getStatusCode | ( |  | ) | const`[inline]`

| Get the 3-digit status code. The 3-digit status code indicates the disposition of the response. Returns: The 3-digit status code Definition at line 172 of file HTTPResponseHeader.h.

virtual void cgicc::HTTPResponseHeader::render | ( | std::ostream & | out | ) | const`[virtual]`

  | Write this object to a stream. Subclasses must implement this function. Parameters:
  out | The ostream to which to write.
Reimplemented from cgicc::MStreamable.

HTTPResponseHeader& cgicc::HTTPResponseHeader::setCookie | ( | const HTTPCookie & | cookie | ) |

  | Set a cookie to go out with this HTTPResponseHeader. Parameters:
  cookie | The HTTPCookie to set

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

- HTTPResponseHeader.h