Peter has posted 2 posts at DZone. View Full User Profile

Generating async version of the GWT remote services

  • submit to reddit


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 generate 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 time with GWT compilation and 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


When your remote service is annotated with one of the following annotation, async interface is automatically generated by the async annotation processor:

  • sk.seges.acris.core.client.annotation.RemoteServicePath


Remote service: 

public interface GWTContentAdministrationServiceRemote extends RemoteService {

        PagedResult<List<ContentDTO>> findAll(Page page);

        ContentDTO merge(ContentDTO content);

        void remove(ContentDTO content);

 right after the file is saved in the eclipse (or netbeans), async version is generated:

@Generated(value = "sk.seges.acris.pap.service.AsyncServiceProcessor")
public interface GWTContentAdministrationServiceRemoteAsync {

        void findAll(Page page, AsyncCallback<PagedResult<List<ContentDTO>>> callback);

        void merge(ContentDTO content, AsyncCallback<ContentDTO> callback);

        void remove(ContentDTO content, AsyncCallback<Void> callback);

Original article is part of the acris wiki:

Published at DZone with permission of its author, Peter Simun.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Uri Boness replied on Mon, 2011/10/10 - 3:15pm

As usual, intellij already supports this for a few years now :-)

Slava Lo replied on Tue, 2011/10/11 - 5:34am

I would say 'not to' have a service on the first place. You can simplify things by utilising request factory pattern or 'request dispatcher' approach similar to Spring's servlet request dispatcher. In this case all rpc communication will go through single remote service which will require one asynch interface to be created.

Peter Simun replied on Tue, 2011/10/11 - 8:15am in response to: Slava Lo

But what about code splitting? If there is one single remote service it's very hard to split your code (at least whole model will be part of the initially downloaded JS)

Jason Hatton replied on Wed, 2011/10/12 - 3:18pm

We use gwt-dispatch. A very simple solution that uses a very extendable command pattern that implements just one GWT-RPC async endpoint. Link is Works nicely with code-splitting too.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.