Header: | #include <CuteServer.h> |
class | HttpBroker |
class | HttpRequest |
class | HttpResponse |
HTTP_DELETE | |
HTTP_GET | |
HTTP_PATCH | |
HTTP_POST | |
HTTP_PUT | |
REGISTER_REMOTE_OBJECT(AbsoluteUrlPath, RemoteObjectTypeName) | |
REMOTE_SIGNAL | |
REMOTE_SLOT |
Classes used by server SDK.
The Cute::Server::HttpBroker allows HTTP handlers to fetch the parsed HttpRequest sent by clients. It also allows HTTP handlers to send the HTTP response back to the client. More...
The Cute::Server::HttpRequest class represents the parsed HTTP requests sent by clients to the server. More...
The Cute::Server::HttpResponse class represents the HTTP response that HTTP handlers send to clients. More...
Makes a public slot available to handle HTTP DELETE requests. The slot must have the following signature:
HTTP_DELETE void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
The Cute server maps the HTTP handler slot to the endpoint composed of the registered class's endpoint and the HTTP handler slot name. If /endpoint is the endpoint of the class containing the mySlotName slot, then the Cute server uses the mySlotName slot to handle HTTP DELETE requests targeting the /endpoint/mySlotName endpoint.
Note that the Cute server creates a new remote object instance whenever an HTTP request is received. Thus, if the client connects to the server and sends multiple HTTP DELETE requests to the /endpoint/mySlotName endpoint, each request is processed by a new instance of the remote object. When the remote object sends the HTTP response to the client, the Cute server calls the deleteLater slot on the remote object. The Cute server closes the connection after sending the HTTP response back to the client if the HTTP response contains the Connection: close header.
Slots can process multiple different HTTP requests. Thus, a slot can be declared as follows:
HTTP_POST HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
Makes a public slot available to handle HTTP GET requests. The slot must have the following signature:
HTTP_GET void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
The Cute server maps the HTTP handler slot to the endpoint composed of the registered class's endpoint and the HTTP handler slot name. If /endpoint is the endpoint of the class containing the mySlotName slot, then the Cute server uses the mySlotName slot to handle HTTP GET requests targeting the /endpoint/mySlotName endpoint.
Note that the Cute server creates a new remote object instance whenever an HTTP request is received. Thus, if the client connects to the server and sends multiple HTTP GET requests to the /endpoint/mySlotName endpoint, each request is processed by a new instance of the remote object. When the remote object sends the HTTP response to the client, the Cute server calls the deleteLater slot on the remote object. The Cute server closes the connection after sending the HTTP response back to the client if the HTTP response contains the Connection: close header.
Slots can process multiple different HTTP requests. Thus, a slot can be declared as follows:
HTTP_POST HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
Makes a public slot available to handle HTTP PATCH requests. The slot must have the following signature:
HTTP_PATCH void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
The Cute server maps the HTTP handler slot to the endpoint composed of the registered class's endpoint and the HTTP handler slot name. If /endpoint is the endpoint of the class containing the mySlotName slot, then the Cute server uses the mySlotName slot to handle HTTP PATCH requests targeting the /endpoint/mySlotName endpoint.
Note that the Cute server creates a new remote object instance whenever an HTTP request is received. Thus, if the client connects to the server and sends multiple HTTP PATCH requests to the /endpoint/mySlotName endpoint, each request is processed by a new instance of the remote object. When the remote object sends the HTTP response to the client, the Cute server calls the deleteLater slot on the remote object. The Cute server closes the connection after sending the HTTP response back to the client if the HTTP response contains the Connection: close header.
Slots can process multiple different HTTP requests. Thus, a slot can be declared as follows:
HTTP_POST HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
Makes a public slot available to handle HTTP POST requests. The slot must have the following signature:
HTTP_POST void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
The Cute server maps the HTTP handler slot to the endpoint composed of the registered class's endpoint and the HTTP handler slot name. If /endpoint is the endpoint of the class containing the mySlotName slot, then the Cute server uses the mySlotName slot to handle HTTP POST requests targeting the /endpoint/mySlotName endpoint.
Note that the Cute server creates a new remote object instance whenever an HTTP request is received. Thus, if the client connects to the server and sends multiple HTTP POST requests to the /endpoint/mySlotName endpoint, each request is processed by a new instance of the remote object. When the remote object sends the HTTP response to the client, the Cute server calls the deleteLater slot on the remote object. The Cute server closes the connection after sending the HTTP response back to the client if the HTTP response contains the Connection: close header.
Slots can process multiple different HTTP requests. Thus, a slot can be declared as follows:
HTTP_POST HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
Makes a public slot available to handle HTTP PUT requests. The slot must have the following signature:
HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
The Cute server maps the HTTP handler slot to the endpoint composed of the registered class's endpoint and the HTTP handler slot name. If /endpoint is the endpoint of the class containing the mySlotName slot, then the Cute server uses the mySlotName slot to handle HTTP PUT requests targeting the /endpoint/mySlotName endpoint.
Note that the Cute server creates a new remote object instance whenever an HTTP request is received. Thus, if the client connects to the server and sends multiple HTTP PUT requests to the /endpoint/mySlotName endpoint, each request is processed by a new instance of the remote object. When the remote object sends the HTTP response to the client, the Cute server calls the deleteLater slot on the remote object. The Cute server closes the connection after sending the HTTP response back to the client if the HTTP response contains the Connection: close header.
Slots can process multiple different HTTP requests. Thus, a slot can be declared as follows:
HTTP_POST HTTP_PUT void mySlotName(QSharedPointer<Cute::Server::HttpBroker> broker);
Registers the class with RemoteObjectTypeName name. The RemoteObjectTypeName name must be fully-qualified. The RemoteObjectTypeName class is mapped to the AbsoluteUrlPath endpoint.
For example, developers can expose the MyRemoteClass class to the endpoint /my_remote_class as follows:
REGISTER_REMOTE_OBJECT("/my_remote_class", The::Fully::Qualified::Name::MyRemoteClass)
If the server is configured to listen on IPV4 localhost on port 2088, than client applications can instantiate the MyRemoteClass remote class on the server as shown below:
RemoteObject remoteObject("The::Fully::Qualified::Name::MyRemoteClass", QUrl("cute://127.0.0.1:2088/my_remote_class"));
Makes a signal available to remote connections. For example:
#include <CuteServer.h> #include <QObject> class TemperatureSensor : public QObject { Q_OBJECT signals: REMOTE_SIGNAL void temperatureChanged(Temperature currentTemperature); };
Makes a public slot available to remote connections. For example:
#include <CuteServer.h> #include <QObject> class Calculator : public QObject { Q_OBJECT public slots: REMOTE_SLOT void addIntegers(qint32 a, qint32 b); };