On 2 juil, 02:56, Daniel Jue <teamp...@gmail.com> wrote:
> (BTW- Thanks for the corrections on my previous email.)
>
> I'm looking on slide 47, with this code:
>
> public void execute(final UpdateContact update,
> final AsyncCallback<GetContactsResponse> cb) {
> realService.execute(update, new
> AsyncCallback<UpdateContactResponse>() {
> public void onFailure(Throwable caught) {
> cb.onFailure(caught);
> }
>
> public void onSuccess(UpdateContactResponse result) {
> recache(update.getContact());
> cb.onSuccess(result);
> ContactChangeEvent e = new ContactChangeEvent(update
> .getContact());
> eventBus.fireEvent(e);
> }
> });
> }
>
> The icon in the upper right seems to indicate this is either in your RPC
> implementation or in the class that calls it.
It's supposed to be a client-side implementation of the service's
*Async that does something more than just sending the request to the
server (as does the implementation created by the generator when you
"instantiate the interface" with GWT.create()); here, the "something
more" is caching the response (in an HashMap or Gears/HTML5 storage)
and broadcasting an event through the event bus.
> I can't watch the video right now, but I don't see the significance of
> having "realService" or the "UpdateContactResponse"
realService is the stub generated at compile time and returned by the
GWT.create() call on the service interface. The code shown above is a
wrapper/proxy around the service to "do something more" (see above).
> Also in the cb.onSuccess(result), result is of the wrong type. What exactly
> is going on here?
I guess it's actually the "cb" argument, declared as
AsyncCallback<GetContentResponse> instead of
AsyncCallback<UpdateContactResponse>.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---