【问题标题】:Gwt RequestFactory: editing a proxy immediately after receiving itGwt RequestFactory:收到代理后立即编辑
【发布时间】:2011-02-17 17:41:16
【问题描述】:

我想在 Receiver.onSuccess 中收到 RequestContext.edit(anObject) 后立即将其放入我的客户端数据库中,因为它已经可编辑。不幸的是,当我这样做时,RequestFactory 抱怨请求已经在进行中。我怎样才能做到这一点?

requestContext.findOrganization(id).fire(new Receiver<OrganizationProxy>()
{
    public void onSuccess(OrganizationProxy response)
    {
        database.put(requestContext.edit(response)); //fails because a request is already in progress
    }
});

【问题讨论】:

    标签: gwt requestfactory


    【解决方案1】:

    我通过使用一次性请求上下文来创建请求,然后使用我更永久的请求上下文来编辑对象来解决这个问题:

    temporaryRequestContext.findOrganization(id).fire(new Receiver<OrganizationProxy>()
    {
        public void onSuccess(OrganizationProxy response)
        {
            database.put(permanentRequestContext.edit(response)); //succeeds because it has not been fired, even though edit() has been called many times
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-05
      • 2023-04-08
      • 1970-01-01
      • 2013-01-15
      相关资源
      最近更新 更多