|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
HTTP REST server implementation. More...
#include <mitkRestServer.h>


Public Member Functions | |
| RestServer () | |
| ~RestServer () override | |
| RestServer (const RestServer &)=delete | |
| RestServer & | operator= (const RestServer &)=delete |
| RestServer (RestServer &&)=delete | |
| RestServer & | operator= (RestServer &&)=delete |
| bool | Start () override |
| Start the REST server with the pending configuration. More... | |
| void | Stop () override |
| Stop the REST server. More... | |
| bool | IsRunning () const override |
| Check if the server is currently running. More... | |
| void | SetConfig (const RestServerConfig &config) override |
| Set the pending server configuration. More... | |
| RestServerConfig | GetPendingConfig () const override |
| Get the pending server configuration. More... | |
| std::optional< RestServerConfig > | GetRunningConfig () const override |
| Get the configuration the server is currently running with. More... | |
| void | SetDataStorage (DataStorage *dataStorage) override |
| Set the DataStorage for REST API operations. More... | |
| DataStorage::Pointer | GetDataStorage () const override |
| Get the currently connected DataStorage. More... | |
| void | SetDispatcher (StorageThreadDispatcherBase *dispatcher) |
| Set the thread dispatcher for DataStorage operations. More... | |
| RenderWindowBridge * | GetRenderWindowBridge () override |
| Return the server-owned RenderWindowBridge. More... | |
| std::optional< std::string > | GetServerUrl () const override |
| Get the full URL where the server is listening. More... | |
| std::optional< std::string > | GetLastError () const override |
| Get the last error message. More... | |
| std::vector< std::string > | GetClientIPs () const override |
| Get the list of client IP addresses that have sent requests. More... | |
| std::optional< RequestInfo > | GetLastRequestInfo () const override |
| Get information about the last request processed. More... | |
| void | SetLogLimit (std::optional< unsigned int > limit) override |
| Set the request log limit. More... | |
| std::optional< unsigned int > | GetLogLimit () const override |
| Get the current request log limit. More... | |
| std::vector< RequestInfo > | GetRequestLog () const override |
| Get all logged requests. More... | |
| void | ClearRequestLog () override |
| Clear all logged requests. More... | |
| uint64_t | GetRequestLogVersion () const override |
| Get the request log version counter. More... | |
| std::optional< int64_t > | GetUptimeSeconds () const override |
| Get the server uptime in seconds. More... | |
Public Member Functions inherited from mitk::IRestServerService | |
| virtual | ~IRestServerService () |
HTTP REST server implementation.
Manages cpp-httplib server lifecycle and routes requests to appropriate controllers.
Definition at line 53 of file mitkRestServer.h.
| mitk::RestServer::RestServer | ( | ) |
|
override |
|
delete |
|
delete |
|
overridevirtual |
Clear all logged requests.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the list of client IP addresses that have sent requests.
Returns a list of unique IP addresses from clients that have made requests to the server since it was started.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the currently connected DataStorage.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the last error message.
Implements mitk::IRestServerService.
|
overridevirtual |
Get information about the last request processed.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the current request log limit.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the pending server configuration.
This is the configuration that will be used on the next Start() call.
Implements mitk::IRestServerService.
|
overridevirtual |
Return the server-owned RenderWindowBridge.
The bridge is owned by the server. UI-layer plugins (e.g. the Qt workbench plugin) configure it by setting callbacks for screenshot capture and crosshair position access. Callbacks must be cleared before the objects they reference are destroyed.
Implements mitk::IRestServerService.
|
overridevirtual |
Get all logged requests.
Returns the request log in chronological order (oldest first).
Implements mitk::IRestServerService.
|
overridevirtual |
Get the request log version counter.
Incremented on every log mutation (new entry, clear, trim). Allows consumers to detect changes without copying the full log.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the configuration the server is currently running with.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the full URL where the server is listening.
Implements mitk::IRestServerService.
|
overridevirtual |
Get the server uptime in seconds.
Implements mitk::IRestServerService.
|
overridevirtual |
Check if the server is currently running.
Implements mitk::IRestServerService.
|
delete |
|
delete |
|
overridevirtual |
Set the pending server configuration.
The configuration will take effect on the next Start() call. If the server is currently running, this only changes the pending config; the running config remains unchanged until Restart().
| config | The new configuration to use on next start. |
Implements mitk::IRestServerService.
|
overridevirtual |
Set the DataStorage for REST API operations.
The server can operate without a DataStorage (graceful degradation), but data storage operations will return appropriate error responses. Can be called while the server is running.
| dataStorage | The DataStorage to use, or nullptr to disconnect. |
Implements mitk::IRestServerService.
| void mitk::RestServer::SetDispatcher | ( | StorageThreadDispatcherBase * | dispatcher | ) |
Set the thread dispatcher for DataStorage operations.
Forwards to the internal DataStorageBridge. If set, all bridge operations are dispatched to the storage-owning thread.
| dispatcher | The dispatcher, or nullptr to clear. |
|
overridevirtual |
Set the request log limit.
Controls how many request entries are kept in the log. The log is cleared when the server starts.
| limit | Maximum number of entries to keep, or std::nullopt for unlimited. |
Implements mitk::IRestServerService.
|
overridevirtual |
Start the REST server with the pending configuration.
If the server is already running, this is a no-op and returns true. The pending configuration becomes the running configuration upon successful start.
Implements mitk::IRestServerService.
|
overridevirtual |
Stop the REST server.
Blocks until the server is fully stopped. If the server is not running, this is a no-op.
Implements mitk::IRestServerService.