I have frequently wanted to write utility code that processes an
object in a particular way on both the client and server side
representation of the object.

Unfortunately, when using RequestFactory, it is difficult to make this
work cleanly.  You can declare that your domain object implements the
proxy interface, and then write your common code in terms of the proxy
interface.  But you will then have to come up with a dummy
implementation of the stableId method required by EntityProxy.  If
that doesn't bother you, then it should work.

Ryan

On Aug 4, 2:32 pm, br22 <[email protected]> wrote:
> Thank you, I have a Java code that can run either on the client or the
> server.
> When on the client it uses the Obj1Proxy that it gets from the server,
> but when it runs on the server it has the original Obj1. I assume that
> it can be solved with “generics” and “implements” , but I don't know
> Java that well.
> Thanks.
>
> On Aug 4, 1:52 pm, Ben Munge <[email protected]> wrote:
>
>
>
>
>
>
>
> > You generally shouldn't be doing this from a design standpoint. If you
> > want to share some simple objects or utilities you could use the
> > shared package, but beyond that would break encapsulation. If you
> > could explain your requirements in a bit more detail I might be able
> > to provide better assistance.
>
> > On Aug 4, 11:24 am, br22 <[email protected]> wrote:
>
> > > Great, but how you make the SAME Java code (that runs both on the
> > > client and the server) share the SAME object (not 2 objects like Obj1
> > > and Obj1Proxy)?
>
> > > On Aug 4, 11:34 am, Ben Munge <[email protected]> wrote:
>
> > > > You create a Proxy object on the client for your corresponding server
> > > > object.
>
> > > >http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html
>
> > > > On Aug 4, 5:46 am, br22 <[email protected]> wrote:
>
> > > > > Sometimes you want the same Java code to run on the client and server.
> > > > > With RPC it is easy to share the same object, what is the best way to
> > > > > do this with RF?
> > > > > Thank You.

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

Reply via email to