Abstract class for responses to WebServerRequests into the AbstractWebServerThis is different from the HttpResponse class in the transport layer which are client-side responses.
More...
#include "client/util/abstract_webserver.h"
List of all members.
Public Member Functions |
| WebServerResponse () |
virtual | ~WebServerResponse () |
util::Status | SendHtml (int http_code, const StringPiece &body) |
| Respond with a text/html content type and body.
|
util::Status | SendText (int http_code, const StringPiece &body) |
| Respond with a text/plain content type and body.
|
virtual util::Status | SendRedirect (int http_code, const StringPiece &url) |
| Respond with a redirect to another url.
|
virtual util::Status | SendReply (const StringPiece &content_type, int http_code, const StringPiece &body)=0 |
| Respond with an specified content type and body.
|
virtual util::Status | AddHeader (const StringPiece &name, const StringPiece &value)=0 |
| Adds a custom header to the repsonse.
|
virtual util::Status | AddCookie (const StringPiece &name, const StringPiece &value)=0 |
| Adds a custom cookie to the repsonse.
|
Detailed Description
Abstract class for responses to WebServerRequests into the AbstractWebServer
This is different from the HttpResponse class in the transport layer which are client-side responses.
These are server side responses.
Responses are owned and created by WebServerRequest.
Constructor & Destructor Documentation
Member Function Documentation
Adds a custom cookie to the repsonse.
This will not check the cookie names or values.
- Parameters:
-
[in] | name | The name of header to add. |
[in] | value | The value of the header. |
Adds a custom header to the repsonse.
Content-Type, Content-Length and Location headers are automatically added. This will not check the header names or values.
- Parameters:
-
[in] | name | The name of header to add. |
[in] | value | The value of the header. |
Respond with a text/html content type and body.
- Parameters:
-
[in] | http_code | The HTTP status code to send. |
[in] | body | The payload can be empty. |
- Returns:
- ok or reason for failure.
Respond with a redirect to another url.
- Parameters:
-
[in] | http_code | The HTTP status code to send (e.g. 307). |
[in] | url | The url to redirect to. |
- Returns:
- ok or reason for failure.
virtual util::Status SendReply |
( |
const StringPiece & |
content_type, |
|
|
int |
http_code, |
|
|
const StringPiece & |
body |
|
) |
| [pure virtual] |
Respond with an specified content type and body.
- Parameters:
-
[in] | content_type | The MIME content type of the body. |
[in] | http_code | The HTTP status code to send. |
[in] | body | The payload can be empty. |
- Returns:
- ok or reason for failure.
Respond with a text/plain content type and body.
- Parameters:
-
[in] | http_code | The HTTP status code to send. |
[in] | body | The payload can be empty. |
- Returns:
- ok or reason for failure.
The documentation for this class was generated from the following file: