24 #include <QCoreApplication> 25 #include <QMetaObject> 26 #include <QMetaMethod> 59 item.insert(QStringLiteral(
"name"), factory->
Description());
60 item.insert(QStringLiteral(
"type"), factory->
MimeType());
67 int index = TorcHTTPServices::staticMetaObject.indexOfClassInfo(
"Version");
68 return (index > -1) ? TorcHTTPServices::staticMetaObject.classInfo(index).value() : QStringLiteral(
"unknown");
73 return tr(
"Services");
80 if (Method.endsWith(QStringLiteral(
"IsSecure")))
82 QVariant sec((
bool)
false);
84 if (connection && connection->
IsSecure())
90 result.insert(QStringLiteral(
"result"), secure);
106 if (method == QStringLiteral(
"GetWebSocketToken") || method == QStringLiteral(
"IsSecure"))
119 if (method == QStringLiteral(
"GetWebSocketToken"))
125 type = QStringLiteral(
"accesstoken");
127 else if (method == QStringLiteral(
"IsSecure"))
227 return QStringLiteral(
"");
void SetAllowed(int Allowed)
void HandlersChanged(void)
QVariantList returnFormats
QVariantMap GetDetails(void)
Return complete application information.
A class to encapsulate an incoming HTTP request.
HTTPRequestType GetHTTPRequestType(void) const
Overlays the Websocket protocol over a QTcpSocket.
TorcLocalContext * gLocalContext
void SubscriberDeleted(QObject *Subscriber)
void ServiceListChanged(void)
Top level interface into services.
QVariantList GetWebSocketProtocols(void)
static TorcSerialiserFactory * GetTorcSerialiserFactory(void)
QString MimeType(void) const
QVariantMap GetServiceList(void)
QString GetUuid(void) const
void HandlersChanged(void)
void ProcessHTTPRequest(const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
TorcSerialiserFactory * NextTorcSerialiserFactory(void) const
static QVariantMap GetServiceHandlers(void)
void Serialise(const QVariant &Data, const QString &Type)
qint64 GetStartTime(void)
static void HandleOptions(TorcHTTPRequest &Request, int Allowed)
QString GetMethod(void) const
TorcHTTPServices(TorcHTTPServer *Server)
void ProcessHTTPRequest(const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
QVariantMap ProcessRequest(const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override
const QString & Description(void) const
void HandleSubscriberDeleted(QObject *Subscriber)
#define TORC_SERVICE_VERSION
QVariantMap ProcessRequest(const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override
static QVariantList GetSupportedSubProtocols(void)
Return a list of supported WebSocket sub-protocols.
static QString GetVersion(void)
void SetStatus(HTTPStatus Status)
QVariantMap GetServiceDescription(const QString &Service)
static bool MethodIsAuthorised(TorcHTTPRequest &Request, int Allowed)
Check the current request is authorised and set the authentication header if not. ...
QString GetUIName(void) override
void SetResponseType(HTTPResponseType Type)
qint64 GetStartTime(void)
QString GetWebSocketToken(void)
Return a WebSocket token for connecting a WebSocket when authentication is required.
static QVariantMap GetServiceDescription(const QString &Service)
static QString GetWebSocketToken(const QString &Host, const QString &Current=QString())
Retrieve an authentication token for the given request or validate a current token.
QVariantList GetReturnFormats(void)