Detailed Description

RESTController handles REST requests.

The controller supports the following actions:

Action default
Handle action according to HTTP method and parameters.
Response Actions
ok In all cases
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 44 of file RESTController.php.

+ Inheritance diagram for RESTController:

Public Member Functions

 initialize (Request $request, Response $response)
 
- Public Member Functions inherited from Controller
 __construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration)
 
 initialize (Request $request, Response $response)
 
 execute ($method=null)
 
 getRequest ()
 
 getResponse ()
 

Protected Member Functions

 validate ()
 
 doExecute ()
 
 handleGet ()
 
 assignResponseDefaults ()
 
 handlePost ()
 
 handlePut ()
 
 handleDelete ()
 
 setLocationHeaderFromOid ($oid)
 
 getFirstRequestOid ()
 
 getRelatedType (ObjectId $sourceOid, $role)
 
- Protected Member Functions inherited from Controller
 validate ()
 
 executeSubAction ($action)
 
 getLogger ()
 
 getSession ()
 
 getPersistenceFacade ()
 
 getPermissionManager ()
 
 getActionMapper ()
 
 getLocalization ()
 
 getMessage ()
 
 getConfiguration ()
 
 assignResponseDefaults ()
 
 isLocalizedRequest ()
 
 checkLanguageParameter ()
 

Member Function Documentation

initialize ( Request  $request,
Response  $response 
)
See also
Controller::initialize()

Definition at line 49 of file RESTController.php.

validate ( )
protected
See also
Controller::validate()

Definition at line 75 of file RESTController.php.

doExecute ( )
protected
See also
Controller::doExecute()

Definition at line 100 of file RESTController.php.

handleGet ( )
protected

Handle a GET request (read object(s) of a given type)

Parameter Description
in collectionBoolean whether to load one object or a list of objects. The Range header is used to get only part of the list
in language The language of the returned object(s)
in className The type of returned object(s)
in id If collection is false, the object with className/_id_ will be loaded
in sortBy _?sortBy=+foo_ for sorting the list by foo ascending or
in sort _?sort(+foo)_ for sorting the list by foo ascending
in limit _?limit(10,25)_ for loading 25 objects starting from position 10
in relation Relation name if objects in relation to another object should be loaded (determines the type of the returned objects)
in sourceId Id of the object to which the returned objects are related (determines the object id together with className)
out Single object or list of objects. In case of a list, the Content-Range header will be set.

Definition at line 140 of file RESTController.php.

assignResponseDefaults ( )
protected
See also
Controller::assignResponseDefaults()

Definition at line 289 of file RESTController.php.

handlePost ( )
protected

Handle a POST request (create an object of a given type)

Parameter Description
in language The language of the object
in className Type of object to create
in relation Relation name if the object should be created/added in relation to another object (determines the type of the created/added object)
in sourceId Id of the object to which the created objects are added (determines the object id together with className)
out Created object data

The object data is contained in POST content. If an existing object should be added, an oid parameter in the object data is sufficient.

Definition at line 310 of file RESTController.php.

handlePut ( )
protected

Handle a PUT request (update an object of a given type)

Parameter Description
in language The language of the object
in className Type of object to update
in id Id of object to update
in relation Relation name if an existing object should be added to a relation (determines the type of the added object)
in sourceId Id of the object to which the added object is related (determines the object id together with className)
in targetId Id of the object to be added to the relation (determines the object id together with relation)
out Updated object data

The object data is contained in POST content.

Definition at line 371 of file RESTController.php.

handleDelete ( )
protected

Handle a DELETE request (delete an object of a given type)

Parameter Description
in language The language of the object
in className Type of object to delete
in id Id of object to delete
in relation Relation name if the object should be deleted from a relation to another object (determines the type of the deleted object)
in sourceId Id of the object to which the deleted object is related (determines the object id together with className)
in targetId Id of the object to be deleted from the relation (determines the object id together with relation)

Definition at line 480 of file RESTController.php.

setLocationHeaderFromOid (   $oid)
protected

Set the location response header according to the given object id.

Parameters
$oidThe serialized object id

Definition at line 509 of file RESTController.php.

getFirstRequestOid ( )
protected

Get the first oid from the request.

Returns
String

Definition at line 521 of file RESTController.php.

getRelatedType ( ObjectId  $sourceOid,
  $role 
)
protected

Get the type that is used in the given role related to the given source object.

Parameters
$sourceOidObjectId of the source object
$roleThe role name
Returns
String

Definition at line 538 of file RESTController.php.