Invoke a GWT RPC service from Java directly

前端 未结 3 1816
离开以前
离开以前 2020-12-30 11:01

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

相关标签:
3条回答
  • 2020-12-30 11:49

    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.

    0 讨论(0)
  • 2020-12-30 11:57

    Are you trying to benchmark the business logic of the service, or how well GWT-RPC itself performs? If you are mostly worried about how well your backend code performs, you could just instantiate the class that implements your service directly:

    MyServiceImpl impl = new MyServiceImpl();
    impl.doSomething();
    

    If you want to test a greater slice of the stack, including the RPC calls, take a look here. There is a section called "running your test in web mode" that has the following line: 'By default, tests run in hosted mode are run as normal Java bytecode in a JVM'. So if you use the described setup, I think you get your tests to run in java by default. Also on that page is info about GWT's built in profiling tools.

    0 讨论(0)
  • 2020-12-30 12:05

    You could use a conventional load testing tool like Grinder to replay post requests to your service. That isn't quite what you are asking but it may be a better way to perform load testing on your application. Grinder can simulate many simultaneous users and so on.

    0 讨论(0)
提交回复
热议问题