|
| Object (std::shared_ptr< Element > parent, std::string uuid, std::string name, std::string description, std::string ontology="") |
| Constructor. More...
|
|
| ~Object () |
| Destructor. More...
|
|
web::json::value | wjson (void) |
| HTTP JSON. More...
|
|
virtual void | read (void) |
| Read callback. More...
|
|
virtual HTTP::Json | insert (HTTP::Json body) |
| Insert callback. More...
|
|
virtual void | remove (void) |
| Remove callback. More...
|
|
HTTP::Response | handle_get (HTTP::Request message, std::smatch match=std::smatch()) override |
| HTTP GET Handler. More...
|
|
HTTP::Response | handle_put (HTTP::Request message, std::smatch match=std::smatch()) override |
| HTTP PUT Handler. More...
|
|
HTTP::Response | handle_delete (HTTP::Request message, std::smatch match=std::smatch()) override |
| HTTP DELETE Handler. More...
|
|
std::shared_ptr< Object > | ptr (void) |
| Get Pointer. More...
|
|
| Element (std::shared_ptr< Element > parent, std::string uuid, std::string name, std::string description, std::string ontology="") |
| Constructor. More...
|
|
virtual | ~Element () |
| Destructor. More...
|
|
std::vector< std::string > | fqid (void) |
| FQID. More...
|
|
std::shared_ptr< Element > | operator[] (std::string fqid) |
| Access Operator. More...
|
|
std::shared_ptr< Element > | add (std::string uuid, std::shared_ptr< Element > child) |
| Add Child Element. More...
|
|
std::shared_ptr< Element > | add (std::string uuid, Element *child) |
| Add Child Element. More...
|
|
bool | insert (std::string uuid, std::shared_ptr< Element > child) |
| Add Child Element. More...
|
|
bool | insert (std::string uuid, Element *child) |
| Add Child Element. More...
|
|
bool | remove (std::string uuid) |
| Remove Child element. More...
|
|
template<typename T > |
T * | cast (void) |
| Get dynamically casted pointer. More...
|
|
bool | is_object (void) const |
| Is Object? More...
|
|
bool | is_variable (void) const |
| Is Variable? More...
|
|
bool | is_function (void) const |
| Is Function? More...
|
|
bool | is_parameter (void) const |
| Is Parameter? More...
|
|
virtual HTTP::Json | wjson (void) |
| HTTP JSON. More...
|
|
virtual std::string | json (void) |
| JSON string. More...
|
|
HTTP::Response | handle (HTTP::Request request, std::smatch match=std::smatch()) |
| HTTP Handler. More...
|
|
| Resource () |
| Constructor. More...
|
|
| ~Resource () |
| Default Destructor. More...
|
|
virtual Response | handle (Request message, std::smatch match=std::smatch()) |
| HTTP Handler. More...
|
|
virtual Response | handle_get (Request message, std::smatch match=std::smatch()) |
| HTTP GET Handler. More...
|
|
virtual Response | handle_put (Request message, std::smatch match=std::smatch()) |
| HTTP PUT Handler. More...
|
|
virtual Response | handle_post (Request message, std::smatch match=std::smatch()) |
| HTTP POST Handler. More...
|
|
virtual Response | handle_delete (Request message, std::smatch match=std::smatch()) |
| HTTP DELETE Handler. More...
|
|
virtual Response | handle_patch (Request message, std::smatch match=std::smatch()) |
| HTTP PATCH Handler. More...
|
|
virtual Response | handle_options (Request message, std::smatch match=std::smatch()) |
| HTTP OPTIONS Handler. More...
|
|
virtual Response | handle_head (Request message, std::smatch match=std::smatch()) |
| HTTP HEAD Handler. More...
|
|
virtual Response | handle_exception (Request message, std::exception &exception, std::smatch match=std::smatch()) |
| HTTP Exception handler. More...
|
|
Class implementing the SOIL Object type. The purpose of Objects is mainly to organize the overall system. Only Objects can have child items, which can be added or removed during runtime. Objects support HTTP GET (read), PUT (add child) and DELETE (remove child) verbs. This class directly inherits from Elememt.
- Todo:
- The HTTP handlers may be moved to protected if HTTP::Server is declared as friend class. Currently this is not done to alllow for greater flexibility.
Definition at line 18 of file Object.h.
Handler that is called by the server on HTTP requests on a DELETE method. This function deletes an element. It should not be overridden directly in subclasses, instead the remove()
function should be overriden. It is mandatory to implement a custom logic in the aforementioned function to allow PUT to properly work. If manual deletaion is not foreseen, you may consider overriding allowed_methods
without DELETE.
If no exception is thrown, an empty response with result code OK is returned, otherwise an Internal Error will be provided.
- Parameters
-
[in] | message | Incoming HTTP request as preprocessed by cpprestsdk |
[in] | match | Match result of the request path that led to this resource |
- Returns
- Outgoing HTTP response to be processed by cpprestdsk
Reimplemented from HTTP::Resource.
Definition at line 75 of file Object.cpp.
Handler that is called by the server on HTTP requests on a PUT method. This function inserts an element to the objects children. It should not be overridden directly in subclasses, instead the HTTP::Json insert(HTTP::Json body)
function should be overriden. It is mandatory to implement a custom logic in the aforementioned function to allow PUT to properly work. If manual insertion is not foreseen, you may consider overriding allowed_methods
without PUT. The minimum requirement to the body is that it contains an valid UUID key with value, the templates and further logic may be implemented by server.
- Parameters
-
[in] | message | Incoming HTTP request as preprocessed by cpprestsdk |
[in] | match | Match result of the request path that led to this resource |
- Returns
- Outgoing HTTP response to be processed by cpprestdsk
Reimplemented from HTTP::Resource.
Definition at line 63 of file Object.cpp.