【问题标题】:Testing GWT and GAE测试 GWT 和 GAE
【发布时间】:2015-01-04 20:05:31
【问题描述】:

我有一个在前端使用 GWT 的 GAE 应用程序。

我想知道是否有一种方法可以测试应用程序是否可以通过 GWT RequestBuilder 调用 GAE 提供的 Restlet RESTful 服务

如果是,最简单的方法是什么?

像这样的调用是我需要测试的:

RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
try{
    builder.setHeader("content-type", "application/json");
    builder.sendRequest(jsonObject, new RequestCallback() {
        public void onResponseReceived(Request request, Response response) {
                // Test
        }
        public void onError(Request request, Throwable throwable) {
                // Test
        }
    });
} catch (RequestException e){
    callback.failure(new Throwable(e.getMessage()));
}

测试从 GWT 到 GAE 的 REST 调用的最佳实践是什么?

【问题讨论】:

    标签: java google-app-engine testing gwt


    【解决方案1】:

    使用 Resty Gwt (https://github.com/resty-gwt/resty-gwt) 或 GWTP Rest Dispatch (https://github.com/ArcBees/GWTP/wiki/Rest-Dispatch)。将您的后端方法建模为其中任何一个的接口,您可以像 GWT RPC 一样访问您的后端。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-27
      • 1970-01-01
      • 2012-05-23
      • 2010-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多