Class AmfphpGet

Description

Implements interfaces:

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.

Located in /Amfphp/Plugins/AmfphpGet/AmfphpGet.php (line 38)


	
			
Class Constant Summary
 CONTENT_TYPE = 'text/amfphpget'
Variable Summary
Method Summary
AmfphpGet __construct ([ $config = null])
void deserialize ( $getData,  $postData,  $rawPostData)
this filterHandler (mixed $handler, String $contentType)
array filterHeaders (array $headers,  $contentType)
the handleDeserializedRequest ( $deserializedRequest,  $serviceRouter)
void handleException ( $exception)
the serialize ( $data)
Variables
mixed $returnErrorDetails = false (line 45)
  • access: protected
Methods
Constructor __construct (line 51)

constructor. Add filters on the HookManager.

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

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.
filterHeaders (line 145)

sets return content type to json

  • access: public
array filterHeaders (array $headers,  $contentType)
  • array $headers
  • $contentType
handleDeserializedRequest (line 87)

Retrieve the serviceName, methodName and parameters from the PHP object

representing the JSON string

the handleDeserializedRequest ( $deserializedRequest,  $serviceRouter)
handleException (line 112)
void handleException ( $exception)
  • Exception $exception
serialize (line 130)

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

the serialize ( $data)
  • $data
Class Constants
CONTENT_TYPE = 'text/amfphpget' (line 43)

the content-type string indicating a cross domain ajax call

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