Hi Alex,

2018-06-01 5:50 GMT+02:00 Alex Harui <[email protected]>:

>
>
> First, regarding your question about whether the parameter should be
> AMFBInaryData or BinaryData, IMO, the answer should be that the parameter
> should be an interface.


We can create a IBinaryData interface, maybe only marker, since I think
most of the methods are different. In Flash there's only one ByteArray, and
then an ObjectEncoding property.
Other option would be some refactor to have only one class, and people
wanting AMF compose the code making it optional.


> If there aren't backward compatibility constraints, we should try to use
> interfaces more in new APIs.  In looking around, I noticed that there is:
>
> Core/src/main/royale/org/apache/royale/utils/IBinaryDataInput.as
> Network/src/main/royale/org/apache/royale/net/utils/IDataInput.as
> Storage/src/main/royale/org/apache/royale/storage/file/IDataInput.as
>
> Seems like there should either be only one,


Right, we need to remove and unify. As I did with UIDUtils/RPCUIDUtils, I
prefer to try to make this work and then refactor and remove and check all
continue working ok.


> and AMFBinaryData and BinaryData should both implement it, or maybe one
> interface should extend the other.  So some refactoring is probably
> warranted there.
>

Agree


>
> Now to your main question.  Are you sure that code 168 is an AMF type
> code?  I could certainly be wrong, but it occurred to me that the 168
> could just be the first byte in serialized data of the message and that the
> AMF decoding should instantiate the object based on the class alias then
> see if it implements IExternalizable and call readExternal without
> bothering to examine that byte in the stream.
>

ok, so if I understand right I must pass the rest of data in AMFBinaryData
to "readExternal" method? If so, readExternal expects an IDataInput....and
is not clear to me how as well give that part of the data Array (maybe I
should create a temporal data array that holds data from current position
to the end of the array?
Sorry but as you is not my area of expertise.

thanks


>
> HTH,
> -Alex
>
> On 5/31/18, 4:57 PM, "[email protected] on behalf of Carlos
> Rovira" <[email protected] on behalf of [email protected]>
> wrote:
>
>     To be more clear on this, what I need is some guidance on how to deal I
>     readValueObject(), EXTERNALIZED_OBJECT case and if I must pass the
> rest of
>     data to the AcknowledgeMessageExt.readExternal method, or pass the
> entire
>     AMFBinaryData to that method. Or another thing I don't have in mind.
>
>     thanks!
>
>
>     2018-06-01 1:37 GMT+02:00 Carlos Rovira <[email protected]>:
>
>     > Hi,
>     >
>     > in order to finish Small Messages implementation I need some
> guidance.
>     > Hope you guys could throw some light on this.
>     >
>     > When turning small messages on, BlazeDS send serialized version of
> some
>     > messages. For example the most important is "*DSK*" (the
>     > registerClassAlias for *AcknowledgeMessageExt.as*), in this case we
> get a
>     > type code *168* in "*readObject*" method from *AMFBinaryData*. We
> can get
>     > as well *169* and *161* codes, don't know if there's more since I
>     > couldn't find any documentation about this.
>     >
>     > So in *readValueObject*() I introduced a new case
> *EXTERNALIZED_OBJECT*
>     > (that is a constant with 168 value)
>     >
>     > Inside we need to deal with the deserialization of the
>     > *AcknowledgeMessageExt* message (the *DSK*).
>     >
>     > This kind of messages like the rest implements all *IExternalizable*
>     > methods (*readExternal*, *writeExternal*), that receive a
> *IDataInput*
>     > and *IDataOutput* respectively.
>     > I get all this code of messages from Flex RPC compile correctly .
> Here I
>     > have a doubt:
>     >
>     > ** When I have a ByteArray param here it should be BinaryData or
>     > AMFBinaryData in Royale?* (I suppose the second, but can't ensure it)
>     >
>     > Finally the main problem...How can I deserialize the DSK object that
> comes
>     > vía AMF
>     >
>     > 1.-* I'm pretty sure that AMFBinaryData must implement IDataInput and
>     > IDataOutput since is the object I suppose I must to pass to
> readExternal or
>     > writeExternal right?*
>     >
>     > 2.- In *readValueObject*(), case *EXTERNALIZED_OBJECT* I tried to do
>     > something like:
>     >
>     > *var dsk: AcknowledgeMessageExt = new AcknowledgeMessageExt()*
>     > *dsk.readExternal (this);*
>     > *value = dsk;*
>     >
>     > this is not working, if not we'll be done ;)
>     >
>     > But as I don't know how flash IExternalizable works under the hood, I
>     > don't know how to deal with this in Royale.
>     >
>     > I suppose that Flash Player manages the readExternal and
> writeExternal
>     > methods under the hood, right? but in Royale I suppose we need to
> call it
>     > ourselves.
>     >
>     > Maybe the IExternalizable, IDataOutput and IDataInput are not right
> as I
>     > write those. Notice that the last two doesn't have all the methods in
>     > Flash. I write only the required ones. I'll write the rest as we get
> the
>     > current problem solved.
>     >
>     > As I said, all messages has the message methods for readExternal and
>     > writeExternal compile in royale, so I think we are so close to get
> this
>     > implementation working hopefully with some help for your part to
> finally
>     > get the final pieces of this puzzle solved :)
>     >
>     > Thanks in advance
>     >
>     > Carlos
>     >
>     >
>     >
>     >
>     >
>     > --
>     > Carlos Rovira
>     > https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
> 7Ceffcd4e8bcf14b3d51dc08d5c75238cc%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C636634078327400307&sdata=iaUSnW4FfeZFtb2q0Hd4aHTUW5wgNy
> zbRIYfna7WD9M%3D&reserved=0
>     >
>     >
>
>
>     --
>     Carlos Rovira
>     https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.com%
> 7Ceffcd4e8bcf14b3d51dc08d5c75238cc%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C636634078327400307&sdata=iaUSnW4FfeZFtb2q0Hd4aHTUW5wgNy
> zbRIYfna7WD9M%3D&reserved=0
>
>
>


-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to