2009年3月24日星期二

Re: [fw-core] Zend_Amf_Server class mapping

Thanks for your response,

but did you read my email?
The blog post is about loading Service classes, not about mapping As
classes to PHP.
BTW my proposal is based on the code of the server, not on the available
docs.
It therefore can be expected, that I didn't miss an existing feature...

Regards
Stefan
> Hi,
>
> I think the answer you are looking for is here:
>
> http://wadearnold.com/blog/?p=103
>
> Regards
> holo
>
>
> 2009/3/23 Stefan Klug <Klug.Stefan@gmx.de <mailto:Klug.Stefan@gmx.de>>
>
> Hi,
>
> this is my first post to this list, so hello everybody ;-)
>
> I've started a project with Zend_Amf_Server and hit several
> problems regarding the Flash->PHP class mapping.
>
> Currently (ZF 1.7.7, but I think this is unchanged in SVN), the
> Amf Server simply checks if the requested class exists and then
> either continues or fails.
> So the only way to get the mapping to work is to load every class,
> which might get used, before calling $server->handle().
> I think it would be nice (and consistent with the Zend-Framework
> style) to have these classes autoloaded in some way.
>
> Here are some further thoughts about possible ways to tackle this,
> and to further ease the use of Zend_Amf_Server:
>
> - We could just remove the check for class_exists, which would
> lead to autoloading the class using standard ZF/user defined
> behaviour. I'm not sure if this might lead to security issues, as
> a AMF Request leads to autoloading a class where the classname is
> controlled by the remote user.
>
> - The autoloading might get limited to a specific directory. This
> is easy if the Zend_Loader is used, but difficult/impossible if a
> custom loader is in use
>
> - A callback to load the given class could be used.
>
> - possibly the transformation applied to service names (e.g.
> replace '.' by _ ) could also be applied to the class names. I
> don't think this should be done, but it would, in some way, be
> consistent to the way Service class names are handled.
>
> - On the outgoing side we might add an option to directly export
> the PHP classnames to the AMF stream and letting Flash/Flex
> resolve the classnames. (e.g. php service method returns a object
> of type Some_PHP_Class which works nicely if the flash class is
> annotated with [RemoteClass(alias="Some_PHP_Class")] ) It seems
> that the current solution is directly modeled after amfphp, with
> java class/package names in mind. This is IMHO not needed anymore.
>
>
> In summary I propose the following additions to Zend_Amf_Server.
>
> function enableClassAutoloading($callback = null);
> if $callback is not given standard php autoloading takes place,
> otherwise the callback is used (the callback should either return
> true or false for a give class name)
>
> function enableExportAllClasses()
> this option would remove the need for $_explicitType and friends.
>
>
> Cheers
> Stefan
>
>
>

没有评论: