Adds support for HTTP GET requests to services, useful for simple test calls and for cross domain ajax calls.
This plugin can be deactivated if the project doesn't use GET requests.
Cross Domain Ajax calls are normally not possible for security reasons, but by using a hack you can get around it. This however must be done with HTTP GET. So this plugin is specifically for requesting json data from amfPHP using HTTP GET. This comes with some limitations: GET is limited in size, and you can't send complex objects. If you're on the same domain, you're probably better off using the AmfphpJson plugin as these limitations don't apply.
You must add the 'text/amfphpget' 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/?contentType=text/amfphpget&serviceName=YourService&methodName=yourMethod&p01=value1&p2=value2 etc.
If you are using this for crossdomain ajax with JSONP, the expected format of the request is to add the extra 'callback' parameter. If no callback id is found, the answer simply contains the json encoded return data. If the callback is found, the answer is wrapped so that it can be used for JSONP.
Thanks to nViso.ch who needed the cross domain ajax functionality.
Requires at least PHP 5.2.
see | \global\http://remysharp.com/2007/10/08/what-is-jsonp/ |
---|---|
see | \global\http://usejquery.com/posts/9/the-jquery-cross-domain-ajax-guide |
package | Amfphp_Plugins_Get |
author | Ariel Sommeria-Klein. |
__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 nullfilterHeaders(array $headers, string $contentType) : array
array
string
array
handleDeserializedRequest(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 responseserialize(mixed $data) : string
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
string
the encoded JSON string sent to JavaScript$returnErrorDetails : boolean
CONTENT_TYPE