Re: Serialization help

2013-05-10 Thread Robert J. Carr
Thanks Jens.  I was thinking the answer is "not possible" but I was just
hoping to get confirmation in case I was missing something silly.  Thanks
for the link ... I'll check it out!


On Fri, May 10, 2013 at 2:06 AM, Jens  wrote:

> At some point during the serialization process GWT is calling getClass()
> on your method return value which always resolves to the runtime class.
> Thats just how getClass() in Java works. I don't think you can change that
> behavior of GWT-RPC.
> If I give you an instance of type Object how would you know that you only
> have to serialize a specific super class of the runtime type of that
> instance? Thats probably only possible by searching for specific
> annotations that contain that information. GWT-RPC does not have such
> annotations.
>
> A somewhat similar question is:
> https://groups.google.com/d/msg/google-web-toolkit/OxuDRkJGFDE/jQd_V0aYzaYJ
>
> You can probably do the same here. Make Subtype a shared class with a
> super-source version for GWT. The super-source version would be empty and
> just extend Type. The CustomFieldSerializer for Subtype would now only
> read/write the Type variables during de-/serialization.
>
> -- J.
>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Web Toolkit" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit/OGsdfcalDpw/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Serialization help

2013-05-10 Thread Jens
At some point during the serialization process GWT is calling getClass() on 
your method return value which always resolves to the runtime class. Thats 
just how getClass() in Java works. I don't think you can change that 
behavior of GWT-RPC.
If I give you an instance of type Object how would you know that you only 
have to serialize a specific super class of the runtime type of that 
instance? Thats probably only possible by searching for specific 
annotations that contain that information. GWT-RPC does not have such 
annotations.

A somewhat similar question 
is: https://groups.google.com/d/msg/google-web-toolkit/OxuDRkJGFDE/jQd_V0aYzaYJ

You can probably do the same here. Make Subtype a shared class with a 
super-source version for GWT. The super-source version would be empty and 
just extend Type. The CustomFieldSerializer for Subtype would now only 
read/write the Type variables during de-/serialization.

-- J.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Serialization help

2013-05-09 Thread rjcarr
Hi Mohammed-

Thanks for taking a look and thanks for the response, but I don't think you 
understood my question (or I wasn't clear enough).

I realize that I'm breaking the "serialization policy".  Specifically, 
Subtype is in the server package and not the client (its parent is 
Serializable, so that isn't the problem).

My question is ... how do I get it to serialize the parent class?  If I 
have an object that is type Subtype I would like it to serialize the Type 
portion of it.  I was hoping a cast would be sufficient but that doesn't 
seem to help.

On Thursday, May 9, 2013 6:10:52 PM UTC-7, Mohammad Al-Quraian wrote:
>
> Any object that is sent/received  via RPC has to adhere to 
> the serialization policy:
>
> https://developers.google.com/web-toolkit/doc/1.6/DevGuideServerCommunication#DevGuideSerializableTypes
>
> So, Subtype has to be Serializable. On ther other hand, if you only want 
> to get Subtype, then just declare that in your service and forget about the 
> Type if you never going to receive it.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Serialization help

2013-05-09 Thread Mohammad Al-Quraian
Any object that is sent/received  via RPC has to adhere to 
the serialization policy:
https://developers.google.com/web-toolkit/doc/1.6/DevGuideServerCommunication#DevGuideSerializableTypes

So, Subtype has to be Serializable. On ther other hand, if you only want to 
get Subtype, then just declare that in your service and forget about the 
Type if you never going to receive it.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Serialization help

2013-05-09 Thread rjcarr
I have a rather involved, but hopefully not unique, serialization question.

I have a basic type that also has a more detailed subtype.  So, to keep it 
simple, say I have:

package client;
class Type implements Serializable {
String name;
}

And a subtype:

package server;
class Subtype extends Type {
File source;
}

Basically, while on the server I care about the details of the subtype but 
when in the client I only care about the basic items.  What I'd like to do 
is create a service:

interface TypeService extends RemoteService {
public Type getType();
}

And in the implementation do something like this:

class TypeServiceImpl extends RemoteServiceServlet implements TypeService 
{
public Type getType() {
return (Type) (new Subtype(file, name));
}
}

But when I try to do this I get an error thrown that looks like this:

com.google.gwt.user.client.rpc.SerializationException: Type 
'server.Subtype' was not included in the set of types which can be 
serialized by this SerializationPolicy or its Class object could not be 
loaded. For security purposes, this type will not be serialized.: instance 
= "Subtype".

How do I get it to serialize the (static) Type and not the (runtime) 
Subtype?

Thanks!


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.