Re: Execute commands between RPC requests

2010-07-06 Thread Bruno Santos
Thank you Thomas, but I can not, please see where this error:

I created a class MyRpcRequestBuilder:
public class MyRpcRequestBuilder extends RpcRequestBuilder {
public MyRpcRequestBuilder() {
// Do something here
}

public void doSetCallback(RequestBuilder rb, RequestCallback callback) {
// Do something here
}

public void doFinish(RequestBuilder rb) {
// Do something here
}
}

Interface xxxServiceAsync:
public interface xxxServiceAsync {
public RequestBuilder method(String variable, AsyncCallbackVoid 
callback);
}

And in class I try to use the feature do so:
xxxServiceAsync Service = GWT.create (xxxService.class);
RpcRequestBuilder theBuilder = new MyRpcRequestBuilder();
...
try {
service.metodo (variable, new AsyncCallbackVoid() {
public void onSuccess(Void result) {
// Do something here
}
public void onFailure (Throwable caught) {
// Do something here
}
}).send();
} catch (Exception ex) {
Window.alert (ex.getMessage ());
}

The error is: callback can not be null

And one more question doSetCallback the method used to when he
initiates the request or have to use another?

-- 
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-tool...@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.



Re: Execute commands between RPC requests

2010-07-06 Thread Bruno Santos
I forgot to tell you that I'm doing this too
((ServiceDefTarget)service).setRpcRequestBuilder(theBuilder);
after
RpcRequestBuilder theBuilder = new MyRpcRequestBuilder();

but the error continues

-- 
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-tool...@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.



Re: Execute commands between RPC requests

2010-07-06 Thread Bruno Santos
solve the problem, the interface replaces the RequestBuilder by void,
removed the .send() and in the method doSetCallback of the class
MyRpcRequestBuilder added the following line:
rb.setCallback (callback);
And in the method doFinish:
rb.setHeader (STRONG_NAME_HEADER, GWT.getPermutationStrongName ());

-- 
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-tool...@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.



Re: Execute commands between RPC requests

2010-07-05 Thread Thomas Broyer


On 5 juil, 20:57, Bruno Santos bruegosan...@gmail.com wrote:
 Is there any way to run a given command at the beginning and end of
 any RPC request?

You can provide an RpcRequestBuilder and either:
 - return your own RequestBuilder from doCreate(), which would
override send() and setCallback()
 - do the beginning command within some doXxx method of the
RpcRequestBuilder (that'd mean just before the send(), but it
shouldn't matter much) and override setCallback() to wrap the
RequestCallback so you can do the end command there (just before or
after delegating to the wrapped callback)

-- 
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-tool...@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.