This class represents what is sent back to the client.
More...
#include <httpresponse.h>
List of all members.
Public Member Functions |
| HttpResponse (int inResponseId, EHSConnection *ipoEHSConnection) |
| Constructs a new instance.
|
virtual | ~HttpResponse () |
| Destructor.
|
void | SetBody (const char *ipsBody, size_t inBodyLength) |
| Sets the body of this instance.
|
void | SetCookie (CookieParameters &iroCookieParameters) |
| Sets cookies for this response.
|
void | SetResponseCode (ResponseCode code) |
| Sets the response code for this response.
|
ResponseCode | GetResponseCode () |
| Retrieves the status code of this this response.
|
StringCaseMap & | GetHeaders () |
| Retrieves the headers of this this response.
|
StringList & | GetCookies () |
| Retrieves the cookies of this this response.
|
void | SetHeader (const std::string &name, const std::string &value) |
| Sets an HTTP header.
|
void | RemoveHeader (const std::string &name) |
| Removes an HTTP header.
|
std::string | GetStatusString () |
| Retrieves the status string of this this response.
|
void | SetDate (time_t stamp) |
| Sets the HTTP Date header.
|
void | SetLastModified (time_t stamp) |
| Sets the HTTP Last-Modified header.
|
std::string | HttpTime (time_t stamp) |
| Utility function for converting a UNIX timestamp into an RFC-conformant HTTP time string.
|
Static Public Member Functions |
static HttpResponse * | Error (ResponseCode code, int inResponseId, EHSConnection *ipoEHSConnection) |
| Constructs a new standardized error response.
|
static HttpResponse * | Error (ResponseCode code, HttpRequest *request) |
| Constructs a new standardized error response.
|
static const char * | GetPhrase (ResponseCode code) |
| Helper function for translating response codes into the corresponding text message.
|
Detailed Description
This class represents what is sent back to the client.
It contains the actual body, any headers specified, and the response code.
- Examples:
-
ehs_basicauth.cpp, ehs_exception.cpp, ehs_formtest.cpp, ehs_mirror.cpp, ehs_privport.cpp, ehs_test.cpp, ehs_testharness.cpp, ehs_uploader.cpp, and ehs_wsgate.cpp.
Constructor & Destructor Documentation
Constructs a new instance.
- Parameters:
-
inResponseId | A unique Id (normally derived from the corresponding request Id). |
ipoEHSConnection | The connection, on which this response should be sent. |
Member Function Documentation
Constructs a new standardized error response.
- Parameters:
-
code | The HTTP error code. |
inResponseId | A unique Id (normally derived from the corresponding request Id). |
ipoEHSConnection | The connection, on which this response should be sent. |
- Returns:
- The new response.
- Examples:
- ehs_exception.cpp, and ehs_wsgate.cpp.
Constructs a new standardized error response.
- Parameters:
-
code | The HTTP error code. |
request | The http request to which this response refers. (Used for initializing the Id and the outgoing connection). |
- Returns:
- The new response.
static const char* GetPhrase |
( |
ResponseCode |
code | ) |
[static] |
Helper function for translating response codes into the corresponding text message.
- Parameters:
-
code | The HTTP result code to be translated. |
- Returns:
- The text message, representing the provided result code.
std::string GetStatusString |
( |
| ) |
|
Retrieves the status string of this this response.
- Returns:
- The current status as "<i>number</i> <i>description</i>".
std::string HttpTime |
( |
time_t |
stamp | ) |
|
Utility function for converting a UNIX timestamp into an RFC-conformant HTTP time string.
- Parameters:
-
stamp | A UNIX timestamp, representing the desired time. |
- Returns:
- A string, containing the HTTP time.
void RemoveHeader |
( |
const std::string & |
name | ) |
[inline] |
Removes an HTTP header.
- Parameters:
-
name | The case insensitive name of the HTTP header to remove. |
- Examples:
- ehs_wsgate.cpp.
Definition at line 146 of file httpresponse.h.
void SetBody |
( |
const char * |
ipsBody, |
|
|
size_t |
inBodyLength |
|
) |
| |
void SetCookie |
( |
CookieParameters & |
iroCookieParameters | ) |
|
void SetDate |
( |
time_t |
stamp | ) |
|
Sets the HTTP Date header.
- Parameters:
-
stamp | A UNIX timestamp, representing the desired time. |
void SetHeader |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| [inline] |
void SetLastModified |
( |
time_t |
stamp | ) |
|
Sets the HTTP Last-Modified header.
- Parameters:
-
stamp | A UNIX timestamp, representing the desired time. |
void SetResponseCode |
( |
ResponseCode |
code | ) |
[inline] |
Sets the response code for this response.
- Parameters:
-
code | The desired HTTP response code. |
Definition at line 115 of file httpresponse.h.
The documentation for this class was generated from the following file: