Chapter 7. Communicating with GWT-RPC


This chapter covers

  • Using GWT-RPC to make remote calls
  • Debugging communication between client and server
  • Protecting against XSRF attacks

At this point in the book you’ve learned the basics of creating a GWT application, allowing you to do some great stuff in the browser. The next step will be learning to communicate with the outside world. GWT offers several tools for this, including HTML forms (chapter 12), RequestBuilder (chapter 12), RequestFactory (chapter 8), and GWT-RPC. HTML forms are exactly as the name implies, and Request-Builder is your typical Ajax solution. But the next two, RequestFactory and GWT-RPC, are special in the sense that they allow you to send Java objects between the client and server, as opposed to JSON,[1] XML, or whatever other program you can dream up.

1 JSON stands for JavaScript Object Notation. Learn more at

In this chapter we discuss GWT-RPC, or GWT Remote Procedure Call, which allows you to call Java methods on the server, passing and receiving back Java objects and primitives. You’ll find this to be a convenient solution for general-purpose RPC calls when you’re already running Java on the server.

7.1. Surveying GWT-RPC

7.2. Learning GWT-RPC with Twitter

7.3. Fetching data from Twitter the non-GWT way

7.4. Defining a GWT-RPC-compatible model

7.5. Building and deploying the server side

7.6. Writing the client

7.7. Debugging GWT-RPC

7.8. Securing GWT-RPC against XSRF attacks

7.9. Summary