GWT RPC可能在窗口关闭处理程序中? [英] GWT RPC possible in window closing handler?

查看:112
本文介绍了GWT RPC可能在窗口关闭处理程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  closeHandlerReg = Window.addCloseHandler(new CloseHandler< Window>() {
@Override
public void onClose(CloseEvent< Window> event){
// ...
}
});

文档说明回调中不显示任何用户界面。关于GWT RPC调用呢?我试图创建一个,但它不会显示在服务器上(无论是在断点还是在日志语句中)。

解决方案

<你应该有可能的用例。当你在closeHandler中进行RPC调用时,它应该到达服务器,因为当它直接返回时,它已经开始发送数据,并设置一个回调来等待结果。但是回调将失败,因为窗口关闭导致连接丢失。但这不是问题,因为您只想通知服务器。所以问题可能是你发送了什么?当它在代码中的其他位置发送,而不是在closeHandler中时,它可以工作吗?


I'm listening for a window close event:

closeHandlerReg = Window.addCloseHandler(new CloseHandler<Window>() {
  @Override
  public void onClose(CloseEvent<Window> event) {
    // ...
  }
});

The documentation says that no UI can be shown in that callback. What about GWT RPC calls? I'm trying to make one, but it isn't showing up on the server (either in breakpoints or log statements).

解决方案

The use case you have should be possible. When you make the RPC call in the closeHandler it should arrive at the server, because while it returns directly, it has started sending the data, and set a callback to wait for the result. However the callback will fail because the connection is lost because the window is closed. But that is no problem as you only want to notify the server. So the question might be what are you sending? and does it work at all, when you send it at some other point in the code, not in the closeHandler?

这篇关于GWT RPC可能在窗口关闭处理程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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