QDjango
|
The QDjangoHttpResponse class represents an HTTP response. More...
#include <QDjangoHttpResponse.h>
Public Types | |
enum | HttpStatus { OK = 200, MovedPermanently = 301, Found = 302, NotModified = 304, BadRequest = 400, AuthorizationRequired = 401, Forbidden = 403, NotFound = 404, MethodNotAllowed = 405, InternalServerError = 500 } |
Enum representing well-known HTTP status codes. | |
Signals | |
void | ready () |
Public Member Functions | |
QDjangoHttpResponse () | |
~QDjangoHttpResponse () | |
QByteArray | body () const |
void | setBody (const QByteArray &body) |
QString | header (const QString &key) const |
void | setHeader (const QString &key, const QString &value) |
virtual bool | isReady () const |
int | statusCode () const |
void | setStatusCode (int code) |
Friends | |
class | QDjangoFastCgiConnection |
class | QDjangoHttpConnection |
The QDjangoHttpResponse class represents an HTTP response.
Constructs a new HTTP response.
Destroys the HTTP response.
QByteArray QDjangoHttpResponse::body | ( | ) | const |
Returns the raw body of the HTTP response.
QString QDjangoHttpResponse::header | ( | const QString & | key | ) | const |
Returns the specified HTTP response header.
key |
bool QDjangoHttpResponse::isReady | ( | ) | const [virtual] |
Returns true if the response is ready to be sent.
The default implementation always returns true. If you subclass QDjangoHttpResponse to support responses which should only be sent to the client at a later point, you need to reimplement this method and emit the ready() signal once the response is ready.
void QDjangoHttpResponse::ready | ( | ) | [signal] |
Emit this signal from your QDjangoHttpResponse subclasses once the response is ready to be sent to the client.
void QDjangoHttpResponse::setBody | ( | const QByteArray & | body | ) |
Sets the raw body of the HTTP response.
The Content-Length header will be updated to reflect the body size.
body |
void QDjangoHttpResponse::setHeader | ( | const QString & | key, |
const QString & | value | ||
) |
Sets the specified HTTP response header.
key | |
value |
void QDjangoHttpResponse::setStatusCode | ( | int | code | ) |
Sets the code for the HTTP response status line.
code |
int QDjangoHttpResponse::statusCode | ( | ) | const |
Returns the code for the HTTP response status line.