QDjango
|
00001 /* 00002 * Copyright (C) 2010-2012 Jeremy Lainé 00003 * Contact: http://code.google.com/p/qdjango/ 00004 * 00005 * This file is part of the QDjango Library. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 */ 00017 00018 #ifndef QDJANGO_HTTP_RESPONSE_H 00019 #define QDJANGO_HTTP_RESPONSE_H 00020 00021 #include <QObject> 00022 00023 #include "QDjangoHttp_p.h" 00024 00025 class QDjangoHttpResponsePrivate; 00026 00031 class QDJANGO_EXPORT QDjangoHttpResponse : public QObject 00032 { 00033 Q_OBJECT 00034 00035 public: 00038 enum HttpStatus { 00039 OK = 200, 00040 MovedPermanently = 301, 00041 Found = 302, 00042 NotModified = 304, 00043 BadRequest = 400, 00044 AuthorizationRequired = 401, 00045 Forbidden = 403, 00046 NotFound = 404, 00047 MethodNotAllowed = 405, 00048 InternalServerError = 500, 00049 }; 00050 00051 QDjangoHttpResponse(); 00052 ~QDjangoHttpResponse(); 00053 00054 QByteArray body() const; 00055 void setBody(const QByteArray &body); 00056 00057 QString header(const QString &key) const; 00058 void setHeader(const QString &key, const QString &value); 00059 00060 virtual bool isReady() const; 00061 00062 int statusCode() const; 00063 void setStatusCode(int code); 00064 00065 signals: 00071 void ready(); 00072 00073 private: 00074 Q_DISABLE_COPY(QDjangoHttpResponse) 00075 QDjangoHttpResponsePrivate* const d; 00076 friend class QDjangoFastCgiConnection; 00077 friend class QDjangoHttpConnection; 00078 }; 00079 00080 #endif