On Sep 16, 10:13 am, Asko Saura <asko.sa...@gmail.com> wrote:
> I've got a bunch of DTOs which include some housekeeping methods used
> by another framework, which I use on the server side. Getting to reuse
> these objects on the client side would be absolutely great. I can't
> use them now, because they happen to include some server-only
> dependencies in methods.
>
> My own plan is to add a "@ServerOnly" annotation on those few methods.

This is what I ended up doing:

"SampleDto" is one of the many DTO classes I use. It includes a few
non-persistent (method-level) dependencies to a server-only framework.
I use a script to autogenerate a source version of SampleDto with all
the server-only stuff left out. Thus, I've got two versions of each
DTO source:

SampleDto.java - for server use
SampleDto.java - for client use

I compile the server versions into .class files. Then I include
a .gwt.xml file describing them as a gwt module and put the .class
files and the client .java files in a jar file.

It seems to work. On the server, I've got access to all the server
functions. On the client, I've got access to the rest. Apparently
(I've not verified it), GWT/RPC works based only on the .java files
set in the gwt module using <source-path/>.

The obvious downside is having to deal with two versions of source.
However, this kind of stuff is very straightforward to automatize; I
don't normally need to see the client-only .java code at all. The
obvious upside is getting to use the same DTO code on the server and
the client without having to build the thing from the ground up based
on GWT constraints.

What have I missed? What are the non-obvious downsides?
--~--~---------~--~----~------------~-------~--~----~
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-toolkit@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