3 #include <QHostAddress>
4 #include <QJsonDocument>
11 #include <THttpRequestHeader>
12 #include <TMultipartFormData>
39 THttpRequest(
const QByteArray &header,
const QString &filePath,
const QHostAddress &clientAddress, TActionContext *context);
48 QString parameter(
const QString &name)
const;
49 QVariantMap allParameters()
const;
51 bool hasQuery()
const {
return !d->queryItems.isEmpty(); }
52 bool hasQueryItem(
const QString &name)
const;
53 QString queryItemValue(
const QString &name)
const;
54 QString queryItemValue(
const QString &name,
const QString &defaultValue)
const;
55 QStringList allQueryItemValues(
const QString &name)
const;
56 QStringList queryItemList(
const QString &key)
const;
57 QVariantList queryItemVariantList(
const QString &key)
const;
58 QVariantMap queryItems(
const QString &key)
const;
59 QVariantMap queryItems()
const;
60 bool hasForm()
const {
return !d->formItems.isEmpty(); }
61 bool hasFormItem(
const QString &name)
const;
62 QString formItemValue(
const QString &name)
const;
63 QString formItemValue(
const QString &name,
const QString &defaultValue)
const;
64 QStringList allFormItemValues(
const QString &name)
const;
65 QStringList formItemList(
const QString &key)
const;
66 QVariantList formItemVariantList(
const QString &key)
const;
67 QVariantMap formItems(
const QString &key)
const;
68 QVariantMap formItems()
const;
70 QByteArray cookie(
const QString &name)
const;
71 QList<TCookie> cookies()
const;
73 QHostAddress originatingClientAddress()
const;
75 bool hasJson()
const {
return !d->jsonData.isNull(); }
76 const QJsonDocument &
jsonData()
const {
return d->jsonData; }
78 static QList<THttpRequest> generate(QByteArray &byteArray,
const QHostAddress &address, TActionContext *context);
79 static QList<QPair<QString, QString>> fromQuery(
const QString &query);
82 QByteArray boundary()
const;
84 static bool hasItem(
const QString &name,
const QList<QPair<QString, QString>> &items);
85 static QString itemValue(
const QString &name,
const QString &defaultValue,
const QList<QPair<QString, QString>> &items);
86 static QStringList allItemValues(
const QString &name,
const QList<QPair<QString, QString>> &items);
87 static QVariantList itemVariantList(
const QString &key,
const QList<QPair<QString, QString>> &items);
88 static QVariantMap itemMap(
const QList<QPair<QString, QString>> &items);
89 static QVariantMap itemMap(
const QString &key,
const QList<QPair<QString, QString>> &items);
92 void parseBody(
const QByteArray &body,
const THttpRequestHeader &header, TActionContext *context);
94 QSharedDataPointer<THttpRequestData> d;
95 QIODevice *bodyDevice {
nullptr};
The THttpRequestData class is for shared THttpRequest data objects.
Definition: thttprequest.h:18
TMultipartFormData multipartFormData
Definition: thttprequest.h:28
QList< QPair< QString, QString > > queryItems
Definition: thttprequest.h:26
THttpRequestHeader header
Definition: thttprequest.h:24
QList< QPair< QString, QString > > formItems
Definition: thttprequest.h:27
QByteArray bodyArray
Definition: thttprequest.h:25
THttpRequestData()
Definition: thttprequest.h:20
QJsonDocument jsonData
Definition: thttprequest.h:29
QHostAddress clientAddress
Definition: thttprequest.h:30
~THttpRequestData()
Definition: thttprequest.h:22
The THttpRequest class contains request information for HTTP.
Definition: thttprequest.h:34
QHostAddress clientAddress() const
Returns the address of the client host.
Definition: thttprequest.h:72
bool hasJson() const
Returns true if the request contains JSON data.
Definition: thttprequest.h:75
TMultipartFormData & multipartFormData()
Returns a object of multipart/form-data.
Definition: thttprequest.h:69
bool hasForm() const
Returns true if the request contains form data.
Definition: thttprequest.h:60
bool hasQuery() const
Returns true if the URL contains a Query.
Definition: thttprequest.h:51
const QJsonDocument & jsonData() const
Return the JSON data contained in the request.
Definition: thttprequest.h:76
const THttpRequestHeader & header() const
Returns the HTTP header of the request.
Definition: thttprequest.h:43
HttpMethod
Definition: tfnamespace.h:21
#define T_CORE_EXPORT
Definition: tdeclexport.h:28