QDjango
Static Public Member Functions | List of all members
QDjangoHttpController Class Reference

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 QDjangoHttpResponseserveAuthorizationRequired (const QDjangoHttpRequest &request, const QString &realm=QLatin1String("Secure Area"))
 
static QDjangoHttpResponseserveBadRequest (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveInternalServerError (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveNotFound (const QDjangoHttpRequest &request)
 
static QDjangoHttpResponseserveRedirect (const QDjangoHttpRequest &request, const QUrl &url, bool permanent=false)
 
static QDjangoHttpResponseserveStatic (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

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.

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

Converts a QDateTime to an HTTP datetime string.

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

Converts an HTTP datetime string to a QDateTime.

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
QDjangoHttpResponse * QDjangoHttpController::serveBadRequest ( const QDjangoHttpRequest request)
static

Respond to a malformed HTTP request.

Parameters
request
QDjangoHttpResponse * QDjangoHttpController::serveInternalServerError ( const QDjangoHttpRequest request)
static

Respond to an HTTP request with an internal server error.

Parameters
request
QDjangoHttpResponse * QDjangoHttpController::serveNotFound ( const QDjangoHttpRequest request)
static

Respond to an HTTP request with a not found error.

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

Respond to an HTTP request with a redirect.

Parameters
request
urlThe URL to which the user is redirected.
permanentWhether the redirect is permanent.
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
docPathThe path to the document, such that it can be opened using a QFile.
expiresAn optional expiry date.

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