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).
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
.
And for production don't forget to added a second servlet mapping entry to the web.xml. You can have a servlet listening to as many URLs as you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With