First thing first, my implementation is for a server that don't have Servlet
! So gwt-dispatch wasn't the thing for me. I use it in another project, but
for this one, I had to build a dispatch api from scratch.

Si I decided to use XML for communication between PHP et my client and use
Request Builder to retreive that XML. So, I CAN'T use real object ! I have
to "serialize" them with a custom class before sending them and then, on
server side, deserialize them. There's a couple things to know when we use
that type of communication.

   1. Server Side is unaware of client side classes. So we can't use clients
   object or server object, that's why I have to "serialize" them in xml. I
   could use JSON btw.
   2. I don't really need a "response" classe like in the model, since this
   classe is used to be send from the server to the client.
   3. We have to do the work twice... That's shitty, but I had to make
   Products obejcts in PHP as well as in java.
   4. The only thing that is sent to the server by the client, is an URL !
   The url to a specific php script that send back an XML reponse. So it's not
   generic, because it's always String that your parse back in XML !

So now, here's the complete meat in action. Hope you'll find something to
use for yourself.
http://pastie.org/598942

So, in SearchProductPresenter I have the @inject is done here and I simply
call (dispatcher.execute) the appropriate action(GetProductsName) and when I
get the response(GotProductsName), I transform it from XML to the type I
want. In service side, when the PHP script is called, it looks at the $_GET
action and print out xml according to the argument.

It's work in progress, I have a couple things to do to generalize the
process on server side, and multiple type of objects actually doesn't work
verry well (For Batching purpose), I chose XML over json for this very
purpose. I can do the same thing to give the server some informations by
adding content to the request, read it on server side and doing the action
as said in my $_GET action string.

Regards

Christian

On Sat, Aug 29, 2009 at 11:17 AM, Jeff Chimene <jchim...@gmail.com> wrote:

>
> Hi Christian:
>
> Thanks for the meat!
>
> I hope you have time for a few questions...
>
> So ServiceCached is:
>
> Public interface ServiceCached  {
> public class GetProductsName implements Action;
> public abstract class GotProductsName implements RequestCallback;
> }
>
> Action: from gwt-dispatch? How do you get past the "extends
> serializable" part of its definition? Serializable seems to bring in
> all kinds of Java RPC baggage; which definitions cause problems at
> link time. I notice that here it's not bound to a generic type.
>
> Why is GotProductsName an abstract class?
>
> I'm assuming that the injection is something like:
>
> @Inject
> Fred (ServiceCached serviceCached) {
> this.serviceCached = serviceCached;
> }
>
> So how does that get us to GetProductsName?
>
> Looking forward to your responses!
>
>
>
> On Sat, Aug 29, 2009 at 6:02 AM, Christian
> Goudreau<goudreau.christ...@gmail.com> wrote:
> > Huh, I have done this with a command pattern style...
> >
> > bind(ServiceCached.
> >
> > class).in(Singleton.class);
> > As simple as that ! I use XML between client and server. Action class
> know
> > what is the url to use and when a response is received, I have a class
> that
> > transform my XML in object.
> >
> > Works fine, I have to rework the cache a little because for now I use a
> > static array.
> >
> > Here's some meat :
> >
> > http://pastie.org/598748
> >
> > I have to change my XMLObjectBuilder for a static one, since I don't
> really
> > need to have more than one instance of it. If I had passed more than one
> > object In my xml file, I simple have to call the same class, with a
> diffrent
> > object, to build the object.
> >
> > Hope you'll find that interresting
> >
> > Christian
> >
> > On Sat, Aug 29, 2009 at 4:36 AM, Jeff Chimene <jchim...@gmail.com>
> wrote:
> >>
> >> It looks like that's the only way.
> >>
> >> One wrinkle that was not mentioned in the original post is that the
> >> URL argument to a RequestBuilder instantiation is RESTful with
> >> volatile path components. IOW, instance bindings will not solve this
> >> problem.
> >>
> >> I'm using binding annotations:
> >>
> >>
>  
> bind(RequestBuilder.class).annotatedWith(XXX.class).toProvider(XXXRequesterAsync.class);
> >>
> >>
> bind(RequestBuilder.class).annotatedWith(YYY.class).toProvider(YYYRequesterAsync.class);
> >>
> >> I'm using the provider binding because I want only one instance of
> >> each implementing class.
> >>
> >> The XXXRequesterClass knows what CGI method and URL to use when
> >> instantiating a RequestBuilder object. The volatile URL path
> >> components are concatenated at runtime.
> >>
> >> Each annotation class (XXX.class, YYY.class) is an interface.
> >>
> >> Discuss amongst yourselves.
> >>
> >> On Fri, Aug 28, 2009 at 6:02 PM, Jeff Chimene<jchim...@gmail.com>
> wrote:
> >> > On 08/28/2009 05:53 PM, Jeff Chimene wrote:
> >> >> Hi,
> >> >>
> >> >> I'm not enough of a Java pundit to understand how to implement a
> >> >> RequestBuilder using Gin.
> >> >>
> >> >> The issue is that one cannot instantiate a RequestBuilder class w/o a
> >> >> HTTP method and a URL.
> >> >>
> >> >> How does one pass these parameters in such a situation?
> >> >
> >> > I thought about using BindingAnnotations. I'm hoping there is Another
> >> > Way.
> >> >
> >> >>
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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