Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
mitk::IRESTManager Class Referenceabstract

This is a microservice interface for managing REST requests. More...

#include <mitkIRESTManager.h>

Inheritance diagram for mitk::IRESTManager:

Public Types

enum  RequestType { RequestType::Get, RequestType::Post, RequestType::Put }
 request type for client requests by calling SendRequest More...
 

Public Member Functions

virtual ~IRESTManager ()
 
virtual pplx::task< web::json::value > SendRequest (const web::uri &uri, const RequestType &type=RequestType::Get, const std::map< utility::string_t, utility::string_t > headers={})=0
 Executes a HTTP request in the mitkRESTClient class. More...
 
virtual pplx::task< web::json::value > SendJSONRequest (const web::uri &uri, const RequestType &type=RequestType::Get, const web::json::value *body=nullptr, const std::map< utility::string_t, utility::string_t > headers={}, const utility::string_t &filePath={})=0
 Executes a HTTP request in the mitkRESTClient class. More...
 
virtual pplx::task< web::json::value > SendBinaryRequest (const web::uri &uri, const RequestType &type=RequestType::Get, const std::vector< unsigned char > *body={}, const std::map< utility::string_t, utility::string_t > headers={})=0
 Executes a HTTP request in the mitkRESTClient class. More...
 
virtual void ReceiveRequest (const web::uri &uri, IRESTObserver *observer)=0
 starts listening for requests if there isn't another observer listening and the port is free More...
 
virtual web::http::http_response Handle (const web::uri &uri, const web::json::value &body, const web::http::method &method, const mitk::RESTUtil::ParamMap &headers)=0
 Handles incoming requests by notifying the observer which should receive it. More...
 
virtual void HandleDeleteObserver (IRESTObserver *observer, const web::uri &uri={})=0
 Handles the deletion of an observer for all or a specific uri. More...
 
virtual const std::map< int, RESTServer * > & GetServerMap ()=0
 
virtual const std::map< std::pair< int, utility::string_t >, IRESTObserver * > & GetObservers ()=0
 

Detailed Description

This is a microservice interface for managing REST requests.

Definition at line 34 of file mitkIRESTManager.h.

Member Enumeration Documentation

◆ RequestType

request type for client requests by calling SendRequest

Enumerator
Get 
Post 
Put 

Definition at line 42 of file mitkIRESTManager.h.

Constructor & Destructor Documentation

◆ ~IRESTManager()

virtual mitk::IRESTManager::~IRESTManager ( )
virtual

Member Function Documentation

◆ GetObservers()

virtual const std::map<std::pair<int, utility::string_t>, IRESTObserver *>& mitk::IRESTManager::GetObservers ( )
pure virtual

Implemented in mitk::RESTManager.

◆ GetServerMap()

virtual const std::map<int, RESTServer *>& mitk::IRESTManager::GetServerMap ( )
pure virtual

Implemented in mitk::RESTManager.

◆ Handle()

virtual web::http::http_response mitk::IRESTManager::Handle ( const web::uri &  uri,
const web::json::value &  body,
const web::http::method &  method,
const mitk::RESTUtil::ParamMap headers 
)
pure virtual

Handles incoming requests by notifying the observer which should receive it.

Parameters
uridefines the URI of the request
bodythe body of the request
methodthe http method of the request
headersthe http headers of the request
Returns
the response

Implemented in mitk::RESTManager.

◆ HandleDeleteObserver()

virtual void mitk::IRESTManager::HandleDeleteObserver ( IRESTObserver observer,
const web::uri &  uri = {} 
)
pure virtual

Handles the deletion of an observer for all or a specific uri.

Parameters
observerthe observer which shouldn't receive requests anymore
urithe uri for which the observer doesn't handle requests anymore (optional)

Implemented in mitk::RESTManager.

◆ ReceiveRequest()

virtual void mitk::IRESTManager::ReceiveRequest ( const web::uri &  uri,
IRESTObserver observer 
)
pure virtual

starts listening for requests if there isn't another observer listening and the port is free

Parameters
uridefines the URI for which incoming requests should be send to the observer
observerthe observer which handles the incoming requests

Implemented in mitk::RESTManager.

◆ SendBinaryRequest()

virtual pplx::task<web::json::value> mitk::IRESTManager::SendBinaryRequest ( const web::uri &  uri,
const RequestType type = RequestType::Get,
const std::vector< unsigned char > *  body = {},
const std::map< utility::string_t, utility::string_t >  headers = {} 
)
pure virtual

Executes a HTTP request in the mitkRESTClient class.

Parameters
uridefines the URI the request is send to
typethe RequestType of the HTTP request (optional)
bodythe body for the request (optional)
headersthe headers for the request (optional)
Returns
task to wait for

Implemented in mitk::RESTManager.

◆ SendJSONRequest()

virtual pplx::task<web::json::value> mitk::IRESTManager::SendJSONRequest ( const web::uri &  uri,
const RequestType type = RequestType::Get,
const web::json::value *  body = nullptr,
const std::map< utility::string_t, utility::string_t >  headers = {},
const utility::string_t &  filePath = {} 
)
pure virtual

Executes a HTTP request in the mitkRESTClient class.

Parameters
uridefines the URI the request is send to
typethe RequestType of the HTTP request (optional)
bodythe body for the request (optional)
headersthe headers for the request (optional)
filePaththe file path to store the request to (optional)
Returns
task to wait for

Implemented in mitk::RESTManager.

◆ SendRequest()

virtual pplx::task<web::json::value> mitk::IRESTManager::SendRequest ( const web::uri &  uri,
const RequestType type = RequestType::Get,
const std::map< utility::string_t, utility::string_t >  headers = {} 
)
pure virtual

Executes a HTTP request in the mitkRESTClient class.

Exceptions
mitk::Exceptionif RequestType is not suported
Parameters
uridefines the URI the request is send to
typethe RequestType of the HTTP request (optional)
headersthe headers for the request (optional)
Returns
task to wait for

Implemented in mitk::RESTManager.


The documentation for this class was generated from the following file: