This is the default handler for the gateway.

It's job is to handle everything that is specific to Amf for the gateway.

todo determine if indirection for serializer/deserializer necessary. Makes gateway code lighter, but is cumbersome
package Amfphp_Core_Amf
author Ariel Sommeria-Klein

 Methods

constructor

__construct(array $sharedConfig) 

Parameters

$sharedConfig

array

deserialize

deserialize(array $getData, array $postData, string $rawPostData) : string
see \Amfphp_Core_Common_IDeserializer

Parameters

$getData

array

$postData

array

$rawPostData

string

Returns

string

handle deserialized request

handleDeserializedRequest(mixed $deserializedRequest, \Amfphp_Core_Common_ServiceRouter $serviceRouter) : mixed

This should not handle exceptions, as this is done separately

see \Amfphp_Core_Common_IDeserializedRequestHandler

Parameters

$deserializedRequest

mixed

Returns

mixed

handle exception

handleException(\Exception $exception) : \Amfphp_Core_Amf_Packet

serialize

serialize(mixed $data) : mixed

The return type is noted as a String, but is a binary stream. echo it to the output buffer

see \Amfphp_Core_Common_ISerializer

Parameters

$data

mixed

Returns

mixed

creates a ServiceCallParameters object from an Amfphp_Core_Amf_Message supported separators in the targetUri are '/' and '.'

getServiceCallParameters(\Amfphp_Core_Amf_Message $Amfphp_Core_Amf_Message) : \Amfphp_Core_Common_ServiceCallParameters

Parameters

$Amfphp_Core_Amf_Message

\Amfphp_Core_Amf_Message

Returns

process a request and generate a response.

handleRequestMessage(\Amfphp_Core_Amf_Message $requestMessage, \Amfphp_Core_Common_ServiceRouter $serviceRouter) : \Amfphp_Core_Amf_Message

throws an Exception if anything fails, so caller must encapsulate in try/catch

Parameters

$requestMessage

\Amfphp_Core_Amf_Message

Returns

\Amfphp_Core_Amf_Messagethe response Message for the request

 Properties

 

$requestPacket : \Amfphp_Core_Amf_Packet

This is an advanced option, and should be used with caution!

 

$responsePacket : \Amfphp_Core_Amf_Packet

This is an advanced option, and should be used with caution!

 

$lastRequestMessageResponseUri : String

This stores the last message's response Uri to be able to give this end point in case of an exception during the handling of the message. The default is '/1', because a response Uri is not always available

 

$returnErrorDetails : boolean

 Constants

 

filter called for exception handling an Amf packet/message, to give a plugin the chance to handle it.

FILTER_AMF_EXCEPTION_HANDLER 

This is for the Flex Messaging plugin to be able to intercept the exception and say it wants to handle it

param

null at call. Return if the plugin can handle

todo consider an interface for $handler. Maybe overkill here
 

filter called for each amf request header, to give a plugin the chance to handle it.

FILTER_AMF_REQUEST_HEADER_HANDLER 

Unless a plugin handles them, amf headers are ignored Headers embedded in the serialized requests are regarded to be a Amf specific, so they get their filter in Amf Handler

param

null at call. Return if the plugin can handle

param

the request header

todo consider an interface for $handler. Maybe overkill here
 

filter called for each amf request message, to give a plugin the chance to handle it.

FILTER_AMF_REQUEST_MESSAGE_HANDLER 

This is for the Flex Messaging plugin to be able to intercept the message and say it wants to handle it

param

null at call. Return if the plugin can handle

param

the request message

todo consider an interface for $handler. Maybe overkill here