QDjango: QDjangoHttpResponse Class Reference

QDjango

Public Types | Signals | Public Member Functions | Friends | List of all members
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
QString | reasonPhrase () 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::QDjangoHttpResponse | ( |  | ) |

Constructs a new HTTP response.

## ◆ ~QDjangoHttpResponse()

QDjangoHttpResponse::~QDjangoHttpResponse | ( |  | ) |

Destroys the HTTP response.

## Member Function Documentation

## ◆ body()

QByteArray QDjangoHttpResponse::body | ( |  | ) | const

Returns the raw body of the HTTP response.

## ◆ header()

QString QDjangoHttpResponse::header | ( | const QString & | key | ) | const

Returns the specified HTTP response header.

Parameters

  key |

## ◆ isReady()

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.

## ◆ 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()

## ◆ reasonPhrase()

QString QDjangoHttpResponse::reasonPhrase | ( |  | ) | const

Returns the reason for the HTTP response status line.

## ◆ setBody()

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 |

## ◆ setHeader()

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

Sets the specified HTTP response header.

Parameters

  key |
  value |

## ◆ setStatusCode()

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

Sets the code for the HTTP response status line.

Parameters

  code |

## ◆ statusCode()

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