直接从Java调用GWT RPC服务 [英] Invoke a GWT RPC service from Java directly

查看:105
本文介绍了直接从Java调用GWT RPC服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有简单的方法直接从Java代码调用GWT RPC服务端点?我的意思是真正的Java代码,而不是将Java代码编译成javascript。



我问,因为我们想对GWT RPC接口运行性能基准测试/压力测试。我想用Java编写测试工具并在JVM中运行它(与在浏览器中运行的JavaScript相反)。



我认为必须有一种方法这样做是因为我假设GWT托管模式需要这样的功能。但是,我无法在GWT运行时中找到任何代码来演示如何干净地执行此操作。我查看了com.google.gwt.user.client.rpc包,但是那里的东西似乎使用了JSNI,这显然不会被纯Java使用。



请参阅 http://www.gdevelop.com/w/blog/2010/01/10/testing-gwt-rpc-services/ 详情。


Is there an easy way to invoke a GWT RPC service endpoint directly from Java code? I mean real Java code, not Java code compiled down into javascript.

I ask because we want to run performance benchmarks/stress tests against a GWT RPC interface. I would like to write the test harness in Java and run it in a JVM (as opposed to javascript running in a browser).

I figure there must be a way to do this because I assume GWT Hosted mode requires such functionality. However, I can't really find any code in the GWT runtime that demonstrates how to cleanly do this. I've looked at the com.google.gwt.user.client.rpc package but the stuff in there seems to use JSNI which obviously wouldn't be usable by pure Java.

解决方案

GWT SyncProxy allows you to access GWT RPC services (e.g methods) from pure Java (not JSNI) code. Thus you can use it to test your RPC interface.

See http://www.gdevelop.com/w/blog/2010/01/10/testing-gwt-rpc-services/ for details.

这篇关于直接从Java调用GWT RPC服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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