Consider the following example with ajax pattern
$.ajax({
url: "someUrl",
beforeSend: function(){
executeBeforeSend();
},
error: function(){
//some error
},
success: function(){
//some success function
}
});
If we there is beforeSend
whick executes just before the server call.
Now we all know that GWT RPC use Ajax to server asynchronous
calls.
private class MessageCallBack implements AsyncCallback<Message> {
@Override
public void onFailure(Throwable caught) {
/* server side error occured */
}
@Override
public void onSuccess(Message result) {
/* server returned result, show user the message */
}
}
But ,there is no method like onBeforeSend
etc.. How to catch
that event
?
Is there any workaround ?
You can use an
RpcRequestBuilder
that returns a subclass ofRequestBuilder
where you've overridden thesend()
methods.