【问题标题】:Weird behavior with Restlet and GAERestlet 和 GAE 的奇怪行为
【发布时间】:2012-06-24 04:59:05
【问题描述】:

我在 Android 客户端的Google AppEngine 中有以下带有Restlet 的代码。

ClientResource clientResource = new ClientResource(RESTLET_TEST_URL);
ProductResource productResource = clientResource.wrap(ProductResource.class);
productResource.store(mProduct);
Status status = clientResource.getResponse().getStatus();
Toast.makeText(this, "Status: "+ status.getDescription(), Toast.LENGTH_SHORT).show();
clientResource.release();

.store() 方法类似于 PUT 请求。奇怪的是,当我连接到开发服务器时,这工作正常,但在实际的 AppEngine 站点上,什么都没有发生。我刚刚收到Status: OK,表示请求已通过。

我无法进行故障排除,因为我只能在开发服务器中执行此操作,并且工作正常。

关于问题可能是什么或如何解决这个问题的任何想法?

供参考,服务端代码为:

if (product != null ) {
    if (new DataStore().putToDataStore(product) ) {
    log.warning("Product written to datastore");
} else {
        log.warning("Product not found in datastore");
    }
}

这只是使用Objectify 对数据存储的简单写入。

【问题讨论】:

    标签: google-app-engine restlet


    【解决方案1】:

    原来这是一个已知问题。见here

    解决方案是使用clientResource.setEntityBuffering(true);。但是请注意,此方法仅适用于 Android 客户端的候选版本,而不适用于稳定版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-15
      • 1970-01-01
      • 1970-01-01
      • 2020-08-04
      • 2011-10-04
      • 2015-03-16
      • 2017-07-04
      相关资源
      最近更新 更多