Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Generating async version of the GWT remote services

DZone's Guide to

Generating async version of the GWT remote services

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

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 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
<dependency>
        <groupId>sk.seges.acris</groupId>
        <artifactId>acris-async-service-processor</artifactId>
        <scope>provided</scope>
        <version>1.2.0</version>
</dependency>

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<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: http://code.google.com/p/acris/wiki/CodeGenerationPlatform_Async
 

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}