Actually I don't think you need to add anything to BlazeDS I think the 
Spring-Flex guys for example already did that work.

I know that you can configure Spring MVC Rest Controllers to auto-serialize 
data depending on the Accept header of a request. So if xml is requested, a xml 
response is sent back, if json is requested, json is returned. With Spring-Flex 
spring uses BlazeDS to serialize AMF if requested by the client. I think It was 
the AmfView approach described here:

http://docs.spring.io/spring-flex/docs/1.5.x/reference/html/#amf-rest

The second thing I stumbled across, is that Flash doesn't support PUT and 
DELETE as the underlying Browsers don't consistently support them. For this 
Spring comes with a Servlet filter where you can send a post or get with an URL 
parameter "_method" which then replaces the method on the server and allows to 
fully use REST services.

But all of this only works with Spring ... so if you are not using Spring, you 
probably have to implement this stuff yourself.

Chris

________________________________________
Von: omup...@gmail.com <omup...@gmail.com> im Auftrag von OmPrakash Muppirala 
<bigosma...@gmail.com>
Gesendet: Dienstag, 1. Dezember 2015 21:42
An: dev@flex.apache.org
Betreff: Re: [FLEXJS] AMF (was Re: AW: lib sprite flexjs,add graphics.as 
(canvas))

I love AMF as well (static typed value objects, one way serialization, no
deserialization required, small file size, etc.)  The biggest problem I
have is with BlazeDS as AMF server.   Because with BlazeDS, all AMF
request/responses need to be done via POST. This means that building true
REST based webservices with BlazeDS/AMF is not possible.

To fix this problem, here is the approach I am taking right now on my apps
on production.

   1. On the server side, all value objects live as POJOs
   2. Create Actionscript stubs for all these classes using GraniteDS's AS3
   generator (GAs3)  Include these AS3 classes in the Flex app.  Development
   is a breeze because I know the types, code completion works, etc.
   3. Create a REST endpoint (using any tech, I use Apache CXF)
   4. The Flex client makes a request to a REST webservice with a
   querystring parameter: resultFormat=amf
   - The REST endpoint generates the POJOs based on application logic and
      uses the Java -> AMF serializer jar from the BlazeDS library and returns
      data
      5. The HTML/JS client makes a request to a REST webservice with a
   querystring parameter: resultFormat=json
   - The REST endpoint uses the same application logic code. Then uses a
      Java -> JSON converter and returns the data

This way, we get all the benefits of REST, caching, etc. at the same time
use AMF for Flex clients.  And the same data is used by a Javascript client
in the form of JSON objects.

This paradigm will perfectly fit the spirit of FlexJS.  Where you optimize
the Flash version to work the best with AMF.  The JS version would use the
JSON version of the same data and run exactly the same way.

If you think about it, the objects that AMF serializes are just objects
with type information.  JSON, by definition describes on the objects but
with no type info.  Any type information AMF has will be of no use in the
Javascript application.  Which means that all that type information is
extra cruft that the JS AMF deserializer would throw away.  Consuming data
as JSON for the JS version would in fact be faster.

Likewise, consuming data as AMF for the Flash version is the best in terms
of performance.  Deserializing the string into JSON seems unnecessary when
AMF does not need any deserializing at all.

This is something that I am very interested in and will add to BlazeDS,
that is when I find some time :-(

In the meantime, if someone wants to help out, this is the area you could
concentrate on.  Especially those who want to see AMF in FlexJS, please do
contribute some time to make this happen.

Thanks,
Om


On Tue, Dec 1, 2015 at 11:59 AM, Harbs <harbs.li...@gmail.com> wrote:

> I’m pretty sure you can use ArrayBuffer.transfer() in place of
> buffer.slice().
>
> On Dec 1, 2015, at 9:55 PM, Alex Harui <aha...@adobe.com> wrote:
>
> >
> >
> > On 12/1/15, 11:52 AM, "Harbs" <harbs.li...@gmail.com> wrote:
> >
> >> I don’t think that’s a problem. I think Uint8ClampedArray is just for
> >> Canvas bitmap data.
> >
> > It was the "1. ArrayBuffer has no slice method in IE 10." that also
> caused
> > me to worry.
> >
> > -Alex
> >
>
>

Reply via email to