69664927a4416d38fa443607fa45a9cf65e5ec3f
wiki/typical-development-scenarios.md
| ... | ... | @@ -42,15 +42,15 @@ One challenge we faced was that the default URL under which a client-side servic |
| 42 | 42 | To change the URL that a client-side service uses to construct the requests to the servlet, a dirty trick is required. The implementation of the service proxy generated by using something like `GWT.create(SailingService.class)` also implements the `com.google.gwt.user.client.rpc.ServiceDefTarget` interface. Casting the service proxy returned by the `GWT.create(...)` call to this interface allows us to set the service's entry point. Here is an excerpt of the method `AbstractEntryPoint.doOnModuleLoad()`: |
| 43 | 43 | |
| 44 | 44 | <pre> |
| 45 | - ServiceDefTarget sailingServiceDef = (ServiceDefTarget) sailingService; |
|
| 46 | - ... |
|
| 47 | - String moduleBaseURL = GWT.getModuleBaseURL(); |
|
| 48 | - String baseURL = moduleBaseURL.substring(0, moduleBaseURL.lastIndexOf('/', moduleBaseURL.length()-2)+1); |
|
| 49 | - sailingServiceDef.setServiceEntryPoint(baseURL + "sailing"); |
|
| 45 | + EntryPointHelper.registerASyncService((ServiceDefTarget) sailingService, RemoteServiceMappingConstants.sailingServiceRemotePath); |
|
| 50 | 46 | </pre> |
| 51 | 47 | |
| 52 | 48 | Whenever you add another GWT RPC service, make sure to add it to the list of services whose service entry point URL is adjusted in `AbstractEntryPoint.doOnModuleLoad()`. |
| 53 | 49 | |
| 50 | +### Adding a GWT RPC service that is implemented in a different bundle |
|
| 51 | + |
|
| 52 | +When the RPC service implementation "lives" in a bundle different from the calling one, you'll need to also register the servlet in the calling bundle's `web.xml`. This is essential because during resolving the serialization policy, the client assumes that the service has the same base URL as the module using it. Adding it to your bundle's `web.xml` is no problem, even if it is declared in one or more other `web.xml` files of other bundles. |
|
| 53 | + |
|
| 54 | 54 | ## Adding a GWT Library to the com.sap.sailing.gwt.ui Project |
| 55 | 55 | * Copy the library (the jar file) to the folder /WEB-INF/lib |
| 56 | 56 | * Add the library to the bundle classpath (in the META-INF/manifest.mf file) |