Frage

I have a project where depending on the user role he's being redirected to completely different UIs right after logging in. I'm planning to separate the project structure into several GWT modules like this:

1. Base module 
2. Login module 
3. Module for role1 
4. Module for role2 
...

I will have all the modules except the Login module extend the Base module where I'll store the common UI components I'll need everywhere. (like profile editing and stuff like that). Login module will act like a bootloader and its task will be just to load the correct module right after user aunenticates.

The problem is that all my server-side services which GWT modules invoke are nearly the same for all modules. I have lots of lookup information providing services and in many other cases one user just fills in the information and the other moderates it, so it's also the same service.

As i understand GWT does the calls to the server using urls pattern like this: gwtModuleName/myServiceUrl so in a way the services are gwt module dependent. How can i "share" a single service between several GWT modules?

War es hilfreich?

Lösung

Very Easy, just put all your client-side service files in the base-module:

com.proj.client.base com.proj.client.base.request --- MyService --- MyServiceAsync com.proj.client.modA com.proj.client.modB

com.proj.server.request -- MyServiceImpl

I use a similar structure for a single app with 10+ modules all sharing the same services.

Just import the service from within the different modules

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top