![]() |
Stellarium
0.16.1
|
Thread-safe version of HttpResponse that can be passed around through QMetaObject::invokeMethod. More...
#include <RemoteControlServiceInterface.hpp>
Public Member Functions | |
APIServiceResponse () | |
Constructs an invalid response. More... | |
void | setHeader (const QByteArray &name, const QByteArray &val) |
Sets a specific HTTP header to the specified value. More... | |
void | setHeader (const QByteArray &name, const int val) |
Shortcut for int header values. More... | |
void | setCacheTime (int seconds) |
Sets the time in seconds for which the browser is allowed to cache the reply. More... | |
void | setStatus (int status, const QByteArray &text) |
Sets the HTTP status type and status text. More... | |
void | setData (const QByteArray &data) |
Replaces the current return data. More... | |
void | appendData (const QByteArray &data) |
Appends to the current return data. More... | |
void | writeRequestError (const QByteArray &msg) |
Sets the HTTP status to 400, and sets the response data to the message. More... | |
void | writeJSON (const QJsonDocument &doc) |
Sets the Content-Type to "application/json" and serializes the given document into JSON text format. More... | |
void | writeWrappedHTML (const QString &html, const QString &title) |
Because the HTML descriptions in Stellarium are often not compatible with "clean" HTML5 which is used for the main interface, this method can be used to explicitely wrap the given HTML snippet in a valid HTML 4.01 transitional document for better results, and include the stylesheet iframestyle.css for consistent styling when used in iframes of the RemoteControl web interface. More... | |
void | writeFile (const QString &path, bool allowCaching=false) |
Writes the specified file contents into the response. More... | |
Friends | |
class | APIController |
Thread-safe version of HttpResponse that can be passed around through QMetaObject::invokeMethod.
It contains the data that will be sent back to the client in the HTTP thread, when control returns to the APIController.
Definition at line 36 of file RemoteControlServiceInterface.hpp.
|
inline |
Constructs an invalid response.
Definition at line 40 of file RemoteControlServiceInterface.hpp.
|
inline |
Appends to the current return data.
Definition at line 75 of file RemoteControlServiceInterface.hpp.
|
inline |
Sets the time in seconds for which the browser is allowed to cache the reply.
Definition at line 57 of file RemoteControlServiceInterface.hpp.
|
inline |
Replaces the current return data.
Definition at line 70 of file RemoteControlServiceInterface.hpp.
|
inline |
Sets a specific HTTP header to the specified value.
Definition at line 46 of file RemoteControlServiceInterface.hpp.
|
inline |
Shortcut for int header values.
Definition at line 51 of file RemoteControlServiceInterface.hpp.
|
inline |
Sets the HTTP status type and status text.
Definition at line 63 of file RemoteControlServiceInterface.hpp.
|
inline |
Writes the specified file contents into the response.
path | The (preferably absolute) path to a file |
allowCaching | if true, the browser is allowed to cache the file for one hour |
Definition at line 122 of file RemoteControlServiceInterface.hpp.
|
inline |
Sets the Content-Type to "application/json" and serializes the given document into JSON text format.
Definition at line 88 of file RemoteControlServiceInterface.hpp.
|
inline |
Sets the HTTP status to 400, and sets the response data to the message.
Definition at line 81 of file RemoteControlServiceInterface.hpp.
|
inline |
Because the HTML descriptions in Stellarium are often not compatible with "clean" HTML5 which is used for the main interface, this method can be used to explicitely wrap the given HTML snippet in a valid HTML 4.01 transitional document for better results, and include the stylesheet iframestyle.css
for consistent styling when used in iframes of the RemoteControl web interface.
html | The HTML snippet to wrap with HTML document tags |
title | The title of the page |
Definition at line 109 of file RemoteControlServiceInterface.hpp.