Provides Synchronous and Asynchronous access to GWT-RPC servlets from Java and Android
Java Other
Clone or download
Latest commit f18a43e Apr 4, 2015

Readme.md

Updates

Work is currently in progress to support Android to GAE login support using OAuth2 Credentials, specifically the Cross Client Identification. See the (in progress) OAuth 2.0 App Engine Authentication wiki for details. This work should resolve potential issues that may occur with the upcoming Google service shutdown of ClientLogin, which is utilized by GSP.

GWT-SyncProxy (GSP)

Google-Web-Toolkit (GWT) uses asynchronous RPC's between client (e.g Browser) and RemoteService servlet. Written in Java, the client-side code is converted to JS when compiled. The client side uses dynamically created Proxy's to handle method calls and serialization back and forth with the server. As such, there is no library within the GWT project to make these method calls from Java that is not translated. GWT-SyncProxy fills that gap.

GWT-SyncProxy provides asynchronous and synchronous RPC between a Java client and RemoteService servlet. By using SyncProxy, we can invoke the GWT RemoteService methods from pure Java (no JSNI) code.

The GWT SyncProxy Android library provides the same system for calling RPC's from Android in the same way the SyncProxy library allows calls to be made from pure Java. There are a few objects that can't yet be serialized properly, but aside from those the library allows GWT style access to GWT RPC servlets. Android API 14(Ice Cream Sandwich) and higher is required to utilize the Google App Engine Login Utilities.

Both libraries also provide Utility methods for providing and using login credentials against App Engine hosted GWT services.

Status and Contribution

This project is currently (0.5) working with GWT 2.7.0 as a base, and has some support back to GWT 2.2 with previous versions of SyncProxy.

The primary repository is available at https://github.com/jcricket/gwt-syncproxy. This project is under new management (effective Feb 2014) and transferred from Google Code to GitHub effective Mar 2015. If you would like to contribute to this project, please open a new issue with label Join Project to get added on to this project or fork it.

Usage Example

GWT SyncProxy allows you to make both Synchronous and Asynchronous calls from a Java or Android application. While most will still prefer the Async style utilized in GWT for the majority of RPC calls, there is a specific scenario where the synchronized method comes in handy. This is for testing GWT services in unit tests. Please see Sebastian Gurin's Blog for details and examples. Below is a quick example of what SyncProxy allows you to do from a Java or Android application (Android is slightly more complex as it needs to be run off the main thread: See Android wiki).

SyncProxy.setBaseUrl("http://myapp.appspot.com/module");
// Normal Async Call Handling
GreetingServiceAsync greetingServiceAsync = SyncProxy.create(GreetingService.class);
greetingServiceAsync.greet("Hello", new AsyncCallback<String>(){
    void onFailure(Throwable throwable){
        // TODO Handle exception
    }
    void onSuccess(String value){
        // Handle return value
    } 
}
// Synchronous calls
GreetingService greetingService = SyncProxy.createSync(GreetingService.class);
String value = greetingService.greet("Hello");

Developers

Are you using SyncProxy in your Project? Let us know so we can generate a list of projects utilizing the SyncProxy Project. Let us know which Library (Java/Android) you are using and a website if you have it!

Changes

The latest Release Notes are available up to version 0.5. The Roadmap is a work in progress and currently targeting version 0.6. Check the Common Issues wiki for a list of problems that may occur and how to resolve them before submitting a ticket. You may also post up to StackOverflow with the 'gwt-syncproxy' tag and we'll help you there.