API Documentation

Zend/Amf/Server.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Amf  
Version
$Id: Server.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Amf_Server

Package: Zend\Amf\Server

An AMF gateway server implementation to allow the connection of the Adobe Flash Player to Zend Framework

Implements
\Zend_Server_Interface
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Todo
Make the reflection methods cache and autoload.  

Properties

Propertyprotected\Zend_Acl  $_acl= ''

ACL handler object

Details
Type
\Zend_Acl
Propertyprotected\Zend_Amf_Auth_Abstract  $_auth= ''

Authentication handler object

Propertyprotectedarray  $_classAllowed= 'array()'

Array of classes that can be called without being explicitly loaded

Keys are class names.

Default valuearray()Details
Type
array
Propertyprotected\Zend_Loader_PluginLoader  $_loader= ''

Loader for classes in added directories

Propertyprotectedarray  $_methods= 'array()'

Array of dispatchables

Default valuearray()Details
Type
array
Propertyprotectedbool  $_production= 'true'

Production flag; whether or not to return exception messages
Default valuetrueDetails
Type
bool
Propertyprotectednull|\Zend_Amf_Request  $_request= 'null'

Request processed

Default valuenullDetails
Type
null\Zend_Amf_Request
Propertyprotectednull|\Zend_Amf_Response  $_response= ''

Class to use for responses

Details
Type
null\Zend_Amf_Response
Propertyprotected\Zend_Session_NameSpace  $_sesionNamespace= ''zend_amf''

Namespace allows all AMF calls to not clobber other PHP session variables

default session namespace zend_amf
Default value'zend_amf'Details
Type
\Zend_Session_NameSpace
Propertyprotectedbool  $_session= 'false'

session flag; whether or not to add a session to each response.
Default valuefalseDetails
Type
bool
Propertyprotectedstring  $_sessionName= ''PHPSESSID''

Set the default session.name if php_

Default value'PHPSESSID'Details
Type
string
Propertyprotectedarray  $_table= 'array()'

Dispatch table of name => method pairs

Default valuearray()Details
Type
array

Methods

methodpublic__construct( ) : void

The server constructor

methodprotected_buildDispatchTable( ) : void

(Re)Build the dispatch table

The dispatch table consists of a an array of method name => Zend_Server_Reflection_Function_Abstract pairs

methodprotected_castParameters( \Reflection $reflectionMethod, array $params ) : array

Cast parameters

Takes the provided parameters from the request, and attempts to cast them to objects, if the prototype defines any as explicit object types

Parameters
Name Type Description
$reflectionMethod \Reflection
$params array
Returns
Type Description
array
methodprotected_checkAcl( string|object $object, string $function ) : \unknown_type

Check if the ACL allows accessing the function or method

Parameters
Name Type Description
$object string|object

Object or class being accessed

$function string

Function or method being accessed

Returns
Type Description
\unknown_type
methodprotected_dispatch( string $method,  $params = null,  $source = null ) : mixed

Loads a remote class or method and executes the function and returns the result

Parameters
Name Type Description
$method string

Is the method to execute

$params
$source
Returns
Type Description
mixed $response the result of executing the method
Throws
Exception Description
\Zend_Amf_Server_Exception
methodprotected_errorMessage( int $objectEncoding, string $message, string $description, mixed $detail, int $code, int $line ) : \Zend_Amf_Value_Messaging_ErrorMessage|array

Create appropriate error message

Parameters
Name Type Description
$objectEncoding int

Current AMF encoding

$message string

Message that was being processed when error happened

$description string

Error description

$detail mixed

Detailed data about the error

$code int

Error code

$line int

Error line

Returns
Type Description
\Zend_Amf_Value_Messaging_ErrorMessage|array
methodprotected_handle( \Zend_Amf_Request $request ) : \Zend_Amf_Response

Takes the deserialized AMF request and performs any operations.

Parameters
Name Type Description
$request \Zend_Amf_Request
Returns
Type Description
\Zend_Amf_Response
Throws
Exception Description
\Zend_Amf_server_Exception|\Exception
Details
Todo
should implement and SPL observer pattern for custom AMF headers  
Todo
DescribeService support  
methodprotected_handleAuth( string $userid, string $password ) : boolean

Handle AMF authentication

Parameters
Name Type Description
$userid string
$password string
Returns
Type Description
boolean
methodprotected_loadCommandMessage( \Zend_Amf_Value_Messaging_CommandMessage $message ) : \Zend_Amf_Value_Messaging_AcknowledgeMessage

Handles each of the 11 different command message types.

A command message is a flex.messaging.messages.CommandMessage

Parameters
Name Type Description
$message \Zend_Amf_Value_Messaging_CommandMessage
Returns
Type Description
\Zend_Amf_Value_Messaging_AcknowledgeMessage
Details
See
\Zend_Amf_Value_Messaging_CommandMessage  
methodpublicaddDirectory( string $dir ) : void

Creates an array of directories in which services can reside.

TODO: add support for prefixes?

Parameters
Name Type Description
$dir string
methodpublicaddFunction( string|array $function, string $namespace = '' ) : \Zend_Amf_Server

Attach a function to the server

Additional arguments to pass to the function at dispatch may be passed; any arguments following the namespace will be aggregated and passed at dispatch time.

Parameters
Name Type Description
$function string|array

Valid callback

$namespace string

Optional namespace prefix

Returns
Type Description
\Zend_Amf_Server
Throws
Exception Description
\Zend_Amf_Server_Exception
methodpublicfault( string|\Exception $fault = null,  $code = 404 ) : void

Raise a server fault

Unimplemented

Parameters
Name Type Description
$fault string|\Exception
$code
methodpublicgetAcl( ) : \Zend_Acl

Get ACL adapter

Returns
Type Description
\Zend_Acl
methodpublicgetAuth( ) : \Zend_Amf_Auth_Abstract

Get authentication adapter

Returns
Type Description
\Zend_Amf_Auth_Abstract
methodpublicgetDirectory( ) : array

Returns an array of directories that can hold services.

Returns
Type Description
array
methodpublicgetFunctions( ) : array

Returns a list of registered methods

Returns an array of dispatchables (Zend_Server_Reflection_Function, _Method, and _Class items).

Returns
Type Description
array
methodprotectedgetLoader( ) : \Zend_Loader_PluginLoader

Get PluginLoader for the Server

Returns
Type Description
\Zend_Loader_PluginLoader
methodpublicgetRequest( ) : null|\Zend_Amf_Request

Return currently registered request object

Returns
Type Description
null|\Zend_Amf_Request
methodpublicgetResponse( ) : \Zend_Amf_Server_Response

get a reference to the Zend_Amf_response instance

Returns
Type Description
\Zend_Amf_Server_Response
methodpublichandle( null|\Zend_Amf_Request $request = null ) : \Zend_Amf_Response

Handle an AMF call from the gateway.

Parameters
Name Type Description
$request null|\Zend_Amf_Request

Optional

Returns
Type Description
\Zend_Amf_Response
methodpublicisProduction( ) : bool

Whether or not the server is in production

Returns
Type Description
bool
methodpublicisSession( ) : bool

Whether of not the server is using sessions

Returns
Type Description
bool
methodpubliclistMethods( ) : array

List all available methods

Returns an array of method names.

Returns
Type Description
array
methodpublicloadFunctions( array $definition ) : void

Load server definition

Unimplemented

Parameters
Name Type Description
$definition array
methodpublicsetAcl( \Zend_Acl $acl ) : \Zend_Amf_Server

Set ACL adapter

Parameters
Name Type Description
$acl \Zend_Acl
Returns
Type Description
\Zend_Amf_Server
methodpublicsetAuth( \Zend_Amf_Auth_Abstract $auth ) : \Zend_Amf_Server

Set authentication adapter

If the authentication adapter implements a "getAcl()" method, populate the ACL of this instance with it (if none exists already).

Parameters
Name Type Description
$auth \Zend_Amf_Auth_Abstract
Returns
Type Description
\Zend_Amf_Server
methodpublicsetClass( string|object $class, string $namespace = '',  $argv = null ) : \Zend_Amf_Server

Attach a class or object to the server

Class may be either a class name or an instantiated object. Reflection is done on the class or object to determine the available public methods, and each is attached to the server as and available method. If a $namespace has been provided, that namespace is used to prefix AMF service call.

Parameters
Name Type Description
$class string|object
$namespace string

Optional

$argv
Returns
Type Description
\Zend_Amf_Server
Throws
Exception Description
\Zend_Amf_Server_Exception on invalid input
methodpublicsetClassMap( string $asClass, string $phpClass ) : \Zend_Amf_Server

Map ActionScript classes to PHP classes

Parameters
Name Type Description
$asClass string
$phpClass string
Returns
Type Description
\Zend_Amf_Server
methodpublicsetPersistence( mixed $mode ) : void

Set server persistence

Unimplemented

Parameters
Name Type Description
$mode mixed
methodpublicsetProduction( bool $flag ) : \Zend_Amf_Server

Set production flag

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Amf_Server
methodpublicsetRequest( string|\Zend_Amf_Request $request ) : \Zend_Amf_Server

Set request object

Parameters
Name Type Description
$request string|\Zend_Amf_Request
Returns
Type Description
\Zend_Amf_Server
methodpublicsetResponse( string|\Zend_Amf_Server_Response $response ) : \Zend_Amf_Server

Public access method to private Zend_Amf_Server_Response reference

Parameters
Name Type Description
$response string|\Zend_Amf_Server_Response
Returns
Type Description
\Zend_Amf_Server
methodpublicsetSession( \default $namespace = 'Zend_Amf' ) : \Zend_Amf_Server

Parameters
Name Type Description
$namespace \default

of all incoming sessions defaults to Zend_Amf

Returns
Type Description
\Zend_Amf_Server
Documentation was generated by DocBlox 0.15.1.