拦截GWT RequestFactory请求 [英] Intercepting GWT RequestFactory requests

查看:84
本文介绍了拦截GWT RequestFactory请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想拦截这样的调用:

有没有办法在客户端拦截RequestFactory请求?

  dummyRequest.dummyOperation()。fire(new Receiver< String>(){
@Override
public void onSuccess(String response){
}
});

这个想法是在与服务器通信时显示一些加载指示。


您可以覆盖默认的传输实现并在RF初始化期间传递它:

 

code> SampleRequestFactory factory = GWT.create(SampleRequestFactory.class);
factory.initialize(new SimpleEventBus(),new DefaultRequestTransport());

您可以继承DefaultRequestTransport并覆盖方法

  send(String payload,TransportReceiver receiver)

在调用超级实现之前进行一些处理,并使用委托包装TransportReceiver来处理结果。


Is there a way to intercept RequestFactory requests on client side?

I want to intercept calls like this:

dummyRequest.dummyOperation().fire( new Receiver<String>() {
  @Override
  public void onSuccess(String response) {        
  }
});

The idea is to show some loading indication when communicating with server.

解决方案

You can override the default transport implementation and pass it during RF initialization:

SampleRequestFactory factory = GWT.create( SampleRequestFactory.class );
factory.initialize( new SimpleEventBus(), new DefaultRequestTransport() );

You can inherit from DefaultRequestTransport and override the method

send(String payload, TransportReceiver receiver)

Do some processing before calling the super-implementation and wrap the TransportReceiver with a delegate to handle the result.

这篇关于拦截GWT RequestFactory请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆