Class AmfphpJson

Description

Implements interfaces:

Enables amfPHP to receive and reply with JSON This plugin can be deactivated if the project doesn't need to support JSON strings and returned as JSON strings using POST parameters.

You must add the 'application/json' content type, or set it in the headers so that it is recognized as a call to be handled by this plugin. for example: http://yourserver.com/Amfphp/?contentType=application/json

Here is some sample code using Javascript with JQuery:

  1.  var callDataObj {"serviceName":"PizzaService""methodName":"getPizza","parameters":[]};
  2.  var callData JSON.stringify(callDataObj);
  3.  $.post("http://yourserver.com/Amfphp/?contentType=application/json"callDataonSuccess);

Requires at least PHP 5.2.

  • author: Yannick DOMINGUEZ

Located in /Amfphp/Plugins/AmfphpJson/AmfphpJson.php (line 33)


	
			
Class Constant Summary
 JSON_CONTENT_TYPE = 'application/json'
Variable Summary
Method Summary
AmfphpJson __construct ([ $config = null])
void deserialize ( $getData,  $postData,  $rawPostData)
this filterHandler (mixed $handler, String $contentType)
the handleDeserializedRequest ( $deserializedRequest,  $serviceRouter)
void handleException ( $exception)
the serialize ( $data)
Variables
mixed $returnErrorDetails = false (line 40)
  • access: protected
Methods
Constructor __construct (line 46)

constructor. Add filters on the HookManager.

  • access: public
AmfphpJson __construct ([ $config = null])
  • array $config: optional key/value pairs in an associative array. Used to override default configuration values.
deserialize (line 68)
  • access: public
void deserialize ( $getData,  $postData,  $rawPostData)
  • array $getData
  • array $postData
  • $rawPostData
filterHandler (line 62)

If the content type contains the 'json' string, returns this plugin

  • return: or null
  • access: public
this filterHandler (mixed $handler, String $contentType)
  • String $contentType
  • mixed $handler: null at call in gateway.
handleDeserializedRequest (line 83)

Retrieve the serviceName, methodName and parameters from the PHP object

representing the JSON string

the handleDeserializedRequest ( $deserializedRequest,  $serviceRouter)
handleException (line 106)
void handleException ( $exception)
  • Exception $exception
serialize (line 124)

Encode the PHP object returned from the service call into a JSON string

the serialize ( $data)
  • $data
Class Constants
JSON_CONTENT_TYPE = 'application/json' (line 38)

the content-type string indicating a JSON content

Documentation generated on Mon, 23 Jan 2012 17:22:02 -0300 by phpDocumentor 1.4.3