You can use RestyGWT custom Dispatcher to track request lifecycle. Dispatcher can be configured manually or using annotations (https://resty-gwt.github.io/documentation/restygwt-user-guide.html). Example setting it manually:
RootRestService rest = GWT.create(RootRestService.class);
((RestServiceProxy) rest).setDispatcher(new DefaultDispatcher() {
@Override public Request send(Method m, RequestBuilder rb) throws RequestException {
RequestCallback callback = rb.getCallback();
rb.setCallback(new RequestCallback() {
@Override public void onResponseReceived(Request req, Response res) {
log.info("request success (stop event)");
callback.onResponseReceived(req, res);
}
@Override public void onError(Request req, Throwable ex) {
log.info("request error (stop event)");
callback.onError(req, ex);
}
});
try {
log.info("request initialized (start event)");
return request = super.send(m, rb);
} finally {
log.info("request fail to initialize error (stop event)");
}
}
});
Instead of logging, you can send an event using the eventBus, and use this event to keep track of the number of active request, and finally show a loading indicator if the number of active request is grater than 0.