Invoke a GWT RPC service from Java directly

前端 未结 3 1841
离开以前
离开以前 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: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.

提交回复
热议问题