Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Using GWT-RPC

GWT extends a browser’s capability to asynchronously communicate with the server by providing a remote procedure call (RPC) library. In general, remote procedure calls aim to simplify the task of making calls to the server by providing you with an interface of methods that can be called similarly to regular method calls. The calls then get marshaled (converted to a stream of data) and sent to the remote server. When the server receives the marshaled data, it unmarshals it and invokes the method on the server.

In GWT, the RPC library is divided into two packages: the com.google.gwt.user.client.rpc package used for client-side RPC support and the com.google.gwt.user.server.rpc package used for server-side RPC support. The client side provides interfaces that you can use to tag your application interface that you’ll use for RPC. When you compile your client project to JavaScript using the GWT compiler, the code required to do the RPC marshaling is generated based on the interfaces you tagged. The Instant Messenger application in Chapter 9 uses GWT-RPC, and the following code declares the interface to be a RPC interface:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint