If you're hoping for some way of making remote calls that will automatically go
through some central point (your dynamic proxy) to do some work that's common
to all calls, I don't think there's a way to do that.
I would suggest the Command pattern though - that's a GoodThing (tm) anyway,
and will let you centralise sending the request.
Paul
On 08/06/11 15:49, Michał Jabłoński wrote:
I am going to create universal proxy to server object. I want to user
call method of class (any kind he creates) on client side which will
be calling the same method on server object and return value. Dynamic
proxy is exactly what I need.
So the only way is to call a class by name?
Paul Robinson wrote:
No. It's not clear exactly what you're trying to achieve, so it's hard to
suggest an alternative. You have almost no reflection available in GWT - almost
the only thing you can do is to ask a class for its name. So passing an
interface as a parameter is not generally useful.
Paul
On 08/06/11 12:32, Michał Jabłoński wrote:
Hi!
It is possible to create dynamic proxy in gwt? I want create library
which changes behaviour of methods of some class (interface will be
parameter), for example, when user call method of class implementing
interface, it will return always String "abc". In java it would be
something like this:
public class proxyHandler implements InvocationHandler {
private Object proxied;
public proxyHandler(Object proxied) {
this.proxied = proxied;
}
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
return "abc";
}
}
..
public static void main(String[] args) {
Object object = new Object();
Interface proxy = (Interface)Proxy.newProxyInstance(
Interface.class.getClassLoader(),
new Class[]{ Interface.class },
new proxyHandler(object));
System.out.println(proxy.getName());
}
It is possible to do something like this in gwt (using deferred
binding, whatever)? Thanks for any help
--
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.