Hyperspace::REST::Resource Class Referenceabstract

The base class for Resources. More...

Inheritance diagram for Hyperspace::REST::Resource:

Public Member Functions

 Resource (const QByteArray &id)
 
QByteArray id () const
 
virtual bool isValid ()=0
 
virtual void head (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload) Q_DECL_OVERRIDE
 Sends back a BadRequest Rebound by default. More...
 
- Public Member Functions inherited from Hyperspace::AbstractWaveTarget
virtual void get (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave GET method. More...
 
virtual void httpDelete (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave DELETE method. More...
 
virtual void post (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave POST method. More...
 
virtual void put (const QByteArray &waveId, const ByteArrayHash &attributes, const QByteArray &payload)=0
 Implement Wave PUT method. More...
 

Additional Inherited Members

- Protected Slots inherited from Hyperspace::AbstractWaveTarget
void sendRebound (const Hyperspace::Rebound &rebound)
 Send a rebound for a received wave. More...
 

Detailed Description

The base class for Resources.

Resources are property containers which are part of a Collection. Each resource is identified by an id, which is part of its URL, and a set of properties.

The default resource object is not reimplementing any method of AbstractWaveTarget, and acts as a base for a fully abstract resource. You usually want to use KeyValueResource or PropertyResource unless you're looking at a very specific use case.

Each Resource is generated by a ResourceFactory, which serves as a helper for constructing Resources based on their ID. ResourceFactory is the way Collection bridges calls to resources, and automatically loads and caches resources generated by the Factory.

See also
Hyperspace::REST::Collection
Hyperspace::REST::ResourceFactory

Constructor & Destructor Documentation

Hyperspace::REST::Resource::Resource ( const QByteArray &  id)
explicit

Constructs a new Resource

id An unique ID identifying the resource, and part of its path.

Member Function Documentation

QByteArray Hyperspace::REST::Resource::id ( ) const
Returns
The unique ID identifying this resource
virtual bool Hyperspace::REST::Resource::isValid ( )
pure virtual
Returns
Whether this resource is valid or not.
void Hyperspace::REST::Resource::head ( const QByteArray &  waveId,
const ByteArrayHash &  attributes,
const QByteArray &  payload 
)
virtual

Sends back a BadRequest Rebound by default.

Implements Hyperspace::AbstractWaveTarget.