I have a really old GWT project and I've been using GWT for many years
now, but I need a little guidance on how this works.

I have a serializable data structure (DTO) that I've been passing via
rpc and it's been working great.  However, there are a number of
things I'd like to keep in this data structure that are only for the
server.  I can't simply mark the members as transient because the
types aren't visible to the gwt compiler.

So, I was thinking I'd have a serializable type for the client, and
then create a sub class of this to keep around my extra stuff, but
only try to serialize the base type.

Let me make some quick pseudocode examples:

// This is what I want to pass over the wire
class gwt.example.client.DTO implements Serializable {
  String s;
  int i;
}

// And this is what I want to keep only for the server
class gwt.example.server.DTOServer extends gwt.example.client.DTO {
  gwt.example.util.Pair p; // not serializable
}

// Here's my service
interface gwt.example.client.DTOService {
  public DTO getDTO()
}

// And here's the implementation
class gwt.example.server.DTOServiceImpl implements
gwt.example.client.DTOService {
  public DTO getDTO() {
    return (DTO) (new DTOServer(s, i, p));
  }
}

And whenever I try this I get an error that looks something like this
(with a bunch of reflection stack traces):

Type 'gwt.example.server.DTOServer' 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.

So I understand that the runtime type of this thing is a DTOServer,
but can't I get gwt to ignore the subclass and only try to serialize
the the base class?

If not, is there anything else I can do in this situation?

Thanks!

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

Reply via email to