18 #ifndef NURIA_RESTFULHTTPNODE_HPP
19 #define NURIA_RESTFULHTTPNODE_HPP
21 #include "httpclient.hpp"
22 #include "httpnode.hpp"
27 #define NURIA_RESTFUL(Path) NURIA_ANNOTATE(org.nuriaproject.network.restful, Path)
34 #define NURIA_RESTFUL_VERBS(Verbs) NURIA_ANNOTATE(org.nuriaproject.network.restful.verbs, int(Verbs))
38 namespace Internal {
struct RestfulHttpNodeSlotData; }
40 class RestfulHttpNodePrivate;
123 explicit RestfulHttpNode (
void *
object, MetaObject *metaObject,
const QString &resourceName,
142 void setRestfulHandler (HttpClient::HttpVerbs verbs,
const QString &path,
143 const QStringList &argumentNames,
const Callback &callback);
150 void setRestfulHandler (
const QString &path,
const QStringList &argumentNames,
151 const Callback &callback);
163 virtual QByteArray convertVariantToData (
const QVariant &variant);
170 virtual QVariant convertArgumentToVariant (
const QString &argumentData,
int targetType);
178 virtual void conversionFailure (
const QVariant &variant,
HttpClient *client);
184 QByteArray generateResultData (QVariant result,
HttpClient *client);
187 bool invokePath (
const QString &path,
const QStringList &parts,
191 friend class RestfulHttpNodePrivate;
193 void registerAnnotatedHandlers ();
194 void registerMetaMethod (MetaMethod &method);
195 void registerRestfulHandlerFromMethod (
const QString &path, MetaMethod &method);
196 void delayedRegisterMetaObject ();
197 QStringList argumentNamesWithoutClient (MetaMethod &method);
198 QString compilePathRegEx (QString path);
199 bool invokeMatch (Internal::RestfulHttpNodeSlotData &slotData,
200 QRegularExpressionMatch &match,
HttpClient *client);
201 QVariantList argumentValues (
const QStringList &names,
const QList<int> &types,
202 QRegularExpressionMatch &match,
HttpClient *client);
203 bool writeResponse (
const QVariant &response,
HttpClient *client);
205 RestfulHttpNodePrivate *d_ptr;
211 #endif // NURIA_RESTFULHTTPNODE_HPP
The RestfulHttpNode class makes it easy to write RESTful APIs.
Definition: restfulhttpnode.hpp:110
The HttpClient class represents a connection to a client.
Definition: httpclient.hpp:92
The HttpNode class represents a virtual directory (or a virtual file) HttpServer uses these nodes to ...
Definition: httpnode.hpp:140