DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generating async version of the GWT remote services

Peter Simun user avatar by
Peter Simun
·
Oct. 10, 11 · Interview
Like (0)
Save
Tweet
Share
7.05K Views

Join the DZone community and get the full member experience.

Join For Free

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>
  •  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<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
 

remote

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Continuous Development: Building the Thing Right, to Build the Right Thing
  • Secrets Management
  • What Is Policy-as-Code? An Introduction to Open Policy Agent
  • Core Machine Learning Metrics

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: