![]() |
Stellarium 0.15.2
|
This class handles the API-specific requests and dispatches them to the correct AbstractAPISerice implementation. More...
#include <APIController.hpp>
Inheritance diagram for APIController:
Collaboration diagram for APIController:Public Member Functions | |
| APIController (int prefixLength, QObject *parent=0) | |
| Constructs an APIController. More... | |
| void | update (double deltaTime) |
| Should be called each frame from the main thread, like from StelModule::update. More... | |
| virtual void | service (HttpRequest &request, HttpResponse &response) |
| Handles an API-specific request. More... | |
| void | registerService (AbstractAPIService *service) |
| Registers a service with the APIController. More... | |
Public Member Functions inherited from HttpRequestHandler | |
| HttpRequestHandler (QObject *parent=NULL) | |
| Constructor. More... | |
| virtual | ~HttpRequestHandler () |
| Destructor. More... | |
This class handles the API-specific requests and dispatches them to the correct AbstractAPISerice implementation.
Services are registered using registerService(). To see the default services used, see the RequestHandler::RequestHandler constructor.
Definition at line 32 of file APIController.hpp.
| APIController::APIController | ( | int | prefixLength, |
| QObject * | parent = 0 |
||
| ) |
Constructs an APIController.
| prefixLength | Determines how many characters to strip from the front of the request path |
| parent | passed on to QObject constructor |
| void APIController::registerService | ( | AbstractAPIService * | service | ) |
Registers a service with the APIController.
The AbstractAPIService::serviceName() determines the request path of the service.
|
virtual |
Handles an API-specific request.
It finds out which AbstractAPIService to use depending on the service name (first part of path until slash). An error is returned for invalid requests. If a service was found, the request is passed on to its AbstractAPIService::get or AbstractAPIService::post method depending on the HTTP request type. If AbstractAPIService::supportsThreadedOperation is false, these methods are called in the Stellarium main thread using QMetaObject::invokeMethod, otherwise they are directly executed in the current thread (HTTP worker thread).
Reimplemented from HttpRequestHandler.
| void APIController::update | ( | double | deltaTime | ) |
Should be called each frame from the main thread, like from StelModule::update.
Passed on to each AbstractAPIService::update method for optional processing.
1.8.11