Loading...
Searching...
No Matches
QDjangoHttpController Class Reference
Http

The QDjangoHttpController class provides static methods for replying to HTTP requests. More...

`#include <QDjangoHttpController.h>`

## Static Public Member Functions

static bool | getBasicAuth (const QDjangoHttpRequest &request, QString &username, QString &password)
static QString | httpDateTime (const QDateTime &dt)
static QDateTime | httpDateTime (const QString &str)
static QDjangoHttpResponse * | serveAuthorizationRequired (const QDjangoHttpRequest &request, const QString &realm=QLatin1String("Secure Area"))
static QDjangoHttpResponse * | serveBadRequest (const QDjangoHttpRequest &request)
static QDjangoHttpResponse * | serveInternalServerError (const QDjangoHttpRequest &request)
static QDjangoHttpResponse * | serveNotFound (const QDjangoHttpRequest &request)
static QDjangoHttpResponse * | serveRedirect (const QDjangoHttpRequest &request, const QUrl &url, bool permanent=false)
static QDjangoHttpResponse * | serveStatic (const QDjangoHttpRequest &request, const QString &filePath, const QDateTime &expires=QDateTime())

## Detailed Description

The QDjangoHttpController class provides static methods for replying to HTTP requests.

## Member Function Documentation

## getBasicAuth()

bool QDjangoHttpController::getBasicAuth | ( | const QDjangoHttpRequest & | request,
|  | QString & | username,
|  | QString & | password )

static

Extract basic credentials from an HTTP request.

Returns true if credentials were provider, false otherwise.

## httpDateTime() [1/2]

QString QDjangoHttpController::httpDateTime | ( | const QDateTime & | dt | ) |

static

Converts a QDateTime to an HTTP datetime string.

## httpDateTime() [2/2]

QDateTime QDjangoHttpController::httpDateTime | ( | const QString & | str | ) |

static

Converts an HTTP datetime string to a QDateTime.

## serveAuthorizationRequired()

QDjangoHttpResponse * QDjangoHttpController::serveAuthorizationRequired | ( | const QDjangoHttpRequest & | request,
|  | const QString & | realm = QLatin1String("Secure Area") )

static

Respond to an HTTP request with an authorization error.

Parameters

  request |
  realm |

## serveBadRequest()

QDjangoHttpResponse * QDjangoHttpController::serveBadRequest | ( | const QDjangoHttpRequest & | request | ) |

static

Respond to a malformed HTTP request.

Parameters

  request |

## serveInternalServerError()

QDjangoHttpResponse * QDjangoHttpController::serveInternalServerError | ( | const QDjangoHttpRequest & | request | ) |

static

Respond to an HTTP request with an internal server error.

Parameters

  request |

## serveNotFound()

QDjangoHttpResponse * QDjangoHttpController::serveNotFound | ( | const QDjangoHttpRequest & | request | ) |

static

Respond to an HTTP request with a not found error.

Parameters

  request |

## serveRedirect()

QDjangoHttpResponse * QDjangoHttpController::serveRedirect | ( | const QDjangoHttpRequest & | request,
|  | const QUrl & | url,
|  | bool | permanent = false )

static

Respond to an HTTP request with a redirect.

Parameters

  request |
  url | The URL to which the user is redirected.
  permanent | Whether the redirect is permanent.

## serveStatic()

QDjangoHttpResponse * QDjangoHttpController::serveStatic | ( | const QDjangoHttpRequest & | request,
|  | const QString & | docPath,
|  | const QDateTime & | expires = QDateTime() )

static

Respond to an HTTP request for a static file.

Parameters

  request |
  docPath | The path to the document, such that it can be opened using a QFile.
  expires | An optional expiry date.

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

- QDjangoHttpController.h
- QDjangoHttpController.cpp