new in 1.6 is the @RemoteServiceRelativePath("...") Annotation. This
makes it somewhat easier to do "Async Singletons"

typically, to get a remote interface in your app, as in the example,
you would do:

GreetingServiceAsync greetingService = GWT.create
(GreetingService.class);

then use greetingService locally. If you need the RPC interface in
more than one place, you would have to pass around the reference,
store it globally, or worse, end up rebinding it....

far easier is to bind it IN the AsyncInterface as a static. It is
bound once, it is globally available, it's the same type, but also can
be passed as a reference. The idiom is simple:

public interface GreetingServiceAsync
{
    public static GreetingServiceAsync RPC = GWT.create
(GreetingService.class);

    void greetServer(String input, AsyncCallback<String> callback);
}

then you can use it simply, safely, ... anywhere in your client code:

GreetingServiceAsync.RPC.greetServer("stuff", new AsyncCallback<String>
()
{
}

This can also be done in 1.4/1.5 with just a little more code....

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