Hi,

I need to check, that everytime I call a service, the user is logged
in the application. To do this I make a call to a function called
isLoggedIn().

I need to do before every call to every service (except for a single
function that is used to check the service) so I've been thinking in
using generator.

For example,

interface FooServ {
  @doNotRewrite
  public boolean check();

  public void doXXX();
}

interface FooServAsync {
  public void check(AsyncCallback<Boolean>);

  public void doXXX(AsyncCallback ac);
}

And I need a wrapper the a class similar to this to be generated:

class FooServAsyncProxy implements FooServAsync {
   FooServAsync realService;

  FooServAsyncProxy() {
     // ** I THINK THIS LINE IS PROBLEMATIC
     this.realService = GWT.create(FooServ.class);
  }

  public void check(AsyncCallback<Boolean> ac) {
     realService.check(ac);
  }

  public void doXXX(AsyncCallback ac) {
    if (checker.isUserLoggedIn()) {
       realService.doXXX(ac)
    } else {
       ac.onFailure(new LoginException("user not logged in"));
    }
  }

}


1. can I call GWT.create in the generated code?
2. what are the missing details of this approach?
3. do I need a new interface for the replacement?


Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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