1
votes

I did some refactoring of my gwt application, and make it multiple modules (i.e. multiple *.gwt.xml and EntryPoint)

Everything seems to work fine, except for the RPC. Since I refactored the application, from a single mygwtapp.gwt.xml into multiple gwt.xml files:

main.gwt.xml
user.gwt.xml
login.gwt.xml 

and so on...

I had to change the servlet mapping URL-pattern from:

/mygwtapp/someRPC

into /main/someRPC to make sure that RPC's will work for the main module. It works for the main module but not for the other modules. As each module is excepting to have RPC call relative to its module name like /user/someRPC

What is the work-around for this kind of scenario?

2

2 Answers

2
votes

Put rpc code in a shared dir, refer to it via source directive in you module descriptor, then make multiple mappings to the same servlet in your ’web.xml`.

<servlet-mapping>
    <servlet-name>SomeServiceServlet</servlet-name>
    <url-pattern>/moduleOne/rpc/SomeService</url-pattern>
    <url-pattern>/moduleTwo/rpc/SomeService</url-pattern>
    <url-pattern>/moduleThree/rpc/SomeService</url-pattern>
</servlet-mapping>
1
votes

you have to options, either to use setServiceEntryPoint() and set the absolute path ("/main/someRpc") or use @RemoteServiceRelativePath but set the path to ("../main/someRpc") :)