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:
var callDataObj = {"serviceName":"PizzaService", "methodName":"getPizza","parameters":[]};
var callData = JSON.stringify(callDataObj);
$.post("http://yourserver.com/Amfphp/?contentType=application/json", callData, onSuccess);
Requires at least PHP 5.2.
package | Amfphp_Plugins_Json |
---|---|
author | Yannick DOMINGUEZ |
__construct(array $config)
Add filters on the HookManager.
array
optional key/value pairs in an associative array. Used to override default configuration values.
deserialize(array $getData, array $postData, string $rawPostData) : string
see | \Amfphp_Core_Common_IDeserializer |
---|
array
array
string
string
filterHandler(mixed $handler, String $contentType) : \this
mixed
null at call in gateway.
String
\this
or nullhandleDeserializedRequest(array $deserializedRequest, \Amfphp_Core_Common_ServiceRouter $serviceRouter) : \the
This should not handle exceptions, as this is done separately
see | \Amfphp_Core_Common_IDeserializedRequestHandler |
---|
array
\Amfphp_Core_Common_ServiceRouter
\the
service call responsehandleException(\Exception $exception) : mixed
see | \Amfphp_Core_Common_IExceptionHandler |
---|
\Exception
mixed
an object describing the error, that will be serialized and sent back to the clientserialize(mixed $data) : \the
The return type is noted as a String, but is a binary stream. echo it to the output buffer
see | \Amfphp_Core_Common_ISerializer |
---|
mixed
\the
encoded JSON string sent to JavaScript$returnErrorDetails : boolean
JSON_CONTENT_TYPE