Hi, I have some service interfaces implemented in a Rest Server
(jersey) and in a GWT client (RequestBuilder). This services are used
in Activities(MVP)
I don't really want to have both syncronous and asyncronous
interfaces. I just want to know if what I am doing is correct.
-- Interface SomeService.class--
public interface SomeService{
ResultDTO doSomeService(int i, String query) ;
}
--- Client Impl SomeServiceClient.class ---
public interface SomeServiceClientImpl implements SomeService{
RequestCallback req;
public SomeServiceClientImpl(RequestCallback req){
this.req = req;
}
@Override
public ResultDTO doSomeService(int i, String query){
RequestBuilder rB = new
RequestBuilder("RequestBuilder.GET",null)
rB.sendRequest("", req); // in try catch block
return null; // always returning null as it is asyncron.
}
}
---Activity Activity.class---
@onStart(){
SomeServiceClient service = new SomeServiceClient(new
RequestCallback(Request req, Responseresp){
@override
onResponseReceived();
@override
onError();
});
service.doSomeService(3, "test");
}
Questions:
a) Do it looks ok to you to pass a RequestCallback in service
constructor?
b) Should I reuse SomeServiceClient or create a new one each time i
want to call .doSomeService() ?
c) Any other thoughts?
d) How do EventBus play role on this? It seems more confortable to use
requestcallbacks than creating several events to comunicate with
services...
Thankyou!
--
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.