Re: openAMF0 and convertion from Action Script tojava.lang.Integer[Viren geprüft]

"Sébastien LABEY" <[email protected]> Thu, 13 Sep 2007 11:47:37 +0200
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
Thanks for your answer,

As I understand (english is not my mother language...), in your case, you
convert from Java to AS with explicit classes.
But in fact it is a little different for me : I transfer an Object that has
an 'id' property with an int value from ActionScript to a java.util.Map to
the Java side. So the "destination" does not describe explicit class to
match, and I suppose (from what you tell me you have in your logs) that
openAMF tries first to convert it to a java.lang.Double object. It seems to
be the default class to convert to from an int...
To resolve this, may I describe the association (AS:int to java.lang.Integer)
that I need in the openamf-config.xml file?

Thanks

Sebastien


On 9/13/07, Stu Thompson <[email protected]> wrote:
>
> Hi Sebastien,
>
> Please post your OpenAMF logs (debug level),  openamf-config.xml file
> and Java API...that will help people spot what your problem is.
>
> Java and ActionScript types do not match up 1:1, but that should not
> prevent you from passing an ID as you mention.  I personally am passing
> an object with a Java int ID property, and the ID as a lone parameter,
> with out problems.  It is a 'Number' in AS and an int in Java.  Yes,
> from what I infer in my own logs, OpenAMF does try to cast it as a
> double when trying to workout what the target method is, but it figures
> it out and everything works.
>
> With my objects, the classes are explicitly described in the OpenAMF
> config file and explicitly matched on our client side AS code.  Are
> yours?
>
> Stu
>
>
> On Wed, 2007-09-12 at 08:52 +0200, Sébastien LABEY wrote:
> > Hi,
> >
> > I'm new to Flex and openAMF0 (from www.renaun.com), and I'm
> > experiencing the following problem :
> > In my mxml file, I call a remote java service in the server side
> > (under Tomcat). I pass the parameters inside an Object in the mxml
> > file and the parameters are converted into a java.util.Map in the java
> > side. This works nicely.
> > I need to pass an int to this remote service (let's imagine this int
> > is the 'id' of a user...), but this int is converted into a
> > java.lang.Double! Because the java service is waiting for an int, I
> > receive a ClassCastException.
> > I do it this way in the mxml file :
> > var params:Object = new Object();
> > params.id=1;
> >
> > In the java server side, the 'id' value is 1.0 under a
> > java.lang.Double.
> >
> > Under which type may I transfer this 'id' param to get it under an int
> > or Integer in the java server?
> >
> > Tell me if I'm not clear...
> >
> > Thanks for your answers.
> >
> > Sebastien
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________ Openamf-user mailing
> list [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Openamf-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Openamf-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openamf-user