All Classes Functions Typedefs Enumerations Enumerator Properties Groups Pages
QDjangoHttpResponse Class Reference
Http

The QDjangoHttpResponse class represents an HTTP response. More...

`#include <QDjangoHttpResponse.h>`

Inheritance diagram for QDjangoHttpResponse:

## 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

## Detailed Description

The QDjangoHttpResponse class represents an HTTP response.

## Constructor & Destructor Documentation

QDjangoHttpResponse::QDjangoHttpResponse | ( | ) |  |

Constructs a new HTTP response.

QDjangoHttpResponse::~QDjangoHttpResponse | ( | ) |  |

Destroys the HTTP response.

## Member Function Documentation

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.

Parameters

  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.

See Also
  isReady()

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.

Parameters

  body |

void QDjangoHttpResponse::setHeader | ( | const QString & | key,
|  | const QString & | value
| ) |  |

Sets the specified HTTP response header.

Parameters

  key |
  value |

void QDjangoHttpResponse::setStatusCode | ( | int | code) |  |

Sets the code for the HTTP response status line.

Parameters

  code |

int QDjangoHttpResponse::statusCode | ( | ) |  | const

Returns the code for the HTTP response status line.

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

- QDjangoHttpResponse.h
- QDjangoHttpResponse.cpp