GWT RPC. Share RPC service bwtween two modules

gwt, java

Solution

You can either map your `RemoteserviceServlet` to both URLs (by far the simplest solution), or you can change your client-side code to make both modules call the same URL.

For the latter, don't use `@RemoteServiceRelativePath` but instead cast your service async to `ServiceDefTarget` and call `setServiceEntryPoint` with the URL you want to use (`@RemoteServiceRelativePath` is only a shortcut to have `setServiceEntryPoint` called automatically with `GWT.getModuleBaseURL() + relativePath`). I believe you could also use a `../`-style URL in your `@RemoteServiceRelativePath`.

Problem

I haven an application with 2 GWT-modules (`.gwt.xml`). I want to share between them one RPC service. But modules have different names, so first module calls RPC service from `FIRSTModuleName/relativepath` (and it works) but second module try to call it from `SECONDModuleName/relativepath` (it doesn't work, because path is incorrect).

Original source