Detailed Description

JsonFormat realizes the JSON request/response format.

All data will be serialized using the json_encode method except for Nodes. Nodes are serialized into an array before encoding (see JsonFormat::serializeValue) using the NodeSerializer class. On serialization the data will be outputted directly using the print command.

JsonFormat collects the response data from all executed controllers into one response array and returns it all at once at the end of script execution. This prevents from having multiple junks of json from each controller response that can't be decoded by clients.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 31 of file JsonFormat.php.

+ Inheritance diagram for JsonFormat:

Public Member Functions

 __construct (NodeSerializer $serializer)
 
 getMimeType ()
 
- Public Member Functions inherited from AbstractFormat
 deserialize (Request $request)
 
 serialize (Response $response)
 

Static Public Member Functions

static printJSONResult ()
 

Protected Member Functions

 afterSerialize ($values)
 
 isSerializedNode ($value)
 
 serializeNode ($value)
 
 deserializeNode ($value)
 
- Protected Member Functions inherited from HierarchicalFormat
 deserializeValues ($values)
 
 serializeValues ($values)
 
 isSerializedNode ($value)
 
 isDeserializedNode ($value)
 
 serializeNode ($value)
 
 deserializeNode ($value)
 
- Protected Member Functions inherited from AbstractFormat
 getRequest ()
 
 getResponse ()
 
 beforeDeserialize ($values)
 
 deserializeValues ($values)
 
 afterDeserialize ($values)
 
 beforeSerialize ($values)
 
 serializeValues ($values)
 
 afterSerialize ($values)
 
 getNode (ObjectId $oid)
 
 filterValue ($value, AttributeDescription $attribute)
 

Protected Attributes

 $_serializer = null
 

Constructor & Destructor Documentation

__construct ( NodeSerializer  $serializer)

Constructor.

Parameters
$serializerNodeSerializer instance

Definition at line 43 of file JsonFormat.php.

Member Function Documentation

static printJSONResult ( )
static

Definition at line 50 of file JsonFormat.php.

getMimeType ( )
See also
Format::getMimeType()

Implements Format.

Definition at line 67 of file JsonFormat.php.

afterSerialize (   $values)
protected
See also
HierarchicalFormat::afterSerialize()

Definition at line 74 of file JsonFormat.php.

isSerializedNode (   $value)
protected
See also
HierarchicalFormat::isSerializedNode()

Definition at line 89 of file JsonFormat.php.

serializeNode (   $value)
protected
See also
HierarchicalFormat::serializeNode()

Definition at line 96 of file JsonFormat.php.

deserializeNode (   $value)
protected
See also
HierarchicalFormat::deserializeNode()

Definition at line 104 of file JsonFormat.php.

Member Data Documentation

$_serializer = null
protected

Definition at line 37 of file JsonFormat.php.