Hi.
Here's my problem. I've got a GWT client-side service method that
makes a remote call to a server. Since the result of the remote call
is returned asynchronously, the service method takes a "callback" as a
parameter. It's basically just an interface with two methods
"onSuccess" and "onFailure".
So everything works great when invoking the service from GWT code, but
the problem is exposing this service method to be invokable by a
separate javascript library. Exposing the service method is possible
with tools akin to GWT exporter, but the problem is with the callback.
The "onSuccess" and "onFailure" methods are obfuscated by the compiler
so I have no reliable way to create a callback object from handwritten
javascript that will work when that method is invoked.
Here's an example for the sake of clarity. Let's say I've got a
service interface defined like this:
public interface MyService {
void getStuff(new MyCallback());
}
And the "MyCallback" interface is defined like this:
public interface MyCallback {
void onSuccess(Stuff stuff);
}
Let's say I bind the "getStuff" method to a javascript method of the
same name. I can then invoke the method from javascript, but I have no
way of reliably constructing an instance of "MyCallback" from
javascript because I don't know what the "onSuccess" method will be
named in javascript after is passes through the GWT compiler.
What I'd really like is to be able to define my callback like this:
public interface MyCallback {
@PreserveMethodName //or some annotation like that.
void onSuccess(Stuff stuff);
}
And then my javascript would look something like:
var callback = {};
callback.onSuccess = function(stuff) {...}
getStuff(callback);
Thoughts? Any suggestions for me?
--
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.