Introduction
Shakespeare would ask: to generate async version of the GWT remote service or to not generate async version of the GWT remote service?Our answer is: definetelly generated them!
- It allows you to keep these two files (remote service interface and async remote service interface) in the sync (maybe you have had a hard times with GWT compilation and knows perfectly this kind of error message: Missing asynchronous version of the synchronous method).
- Thanks to eclipse annotation processing support it is perfectly integrated with your IDE and async remote service interface is automatically regenerated after each change in the remote service interface).
Maven configuration
- Add following dependency to your pom.xml
<dependency> <groupId>sk.seges.acris</groupId> <artifactId>acris-async-service-processor </artifactId> <scope>provided</scope> <version>1.2.0</version> </dependency>
- create .pap file in your project in order to enable annotation processors - see profiles activation wiki
Execution
When your remote service is annotated with one of the following annotation, async interface is automatically generated by the async annotation processor:- com.google.gwt.user.client.rpc.RemoteServiceRelativePath
- sk.seges.acris.core.client.annotation.RemoteServicePath
Example
Remote service:
@RemoteServiceRelativePath("/service")
public interface GWTContentAdministrationServiceRemote
extends RemoteService {
PagedResult> findAll(Page page);
ContentDTO merge(ContentDTO content);
void remove(ContentDTO content);
}
@Generated(value = "sk.seges.acris.pap.service.AsyncServiceProcessor")
public interface GWTContentAdministrationServiceRemoteAsync {
void findAll(Page page,
AsyncCallback>> callback);
void merge(ContentDTO content, AsyncCallback callback);
void remove(ContentDTO content, AsyncCallback callback);
}