I would like to incorporate a GWT front-end into a Spring application. This Spring application will have several different kinds of views. GWT will be only one of them.
Given this requirement, it would be nice to decouple the GWT from the server-side code. The GWT Http Request Classes in com.google.gwt.http.client look like an attractive alternative to RPC.
I am a GWT newbie. Perhaps I am not understanding what RPC does. But I ask, for the sake of drawing out the issue,
Why would one ever want to use GWT RPC? Why would not one want always want to use the Http Client classes, in order to decouple server-side code from client-code, with plain Java controller code on the server not wedded to GWT specifics?
or, if the RPC code is necessary, what would be the best way to encapsulate it in this multiple view-style Spring application? Put it into a "GWTController"?
Write a servlet on server side. Everything works like a magic. This is what a GWT RPC gives you. All your client UI code does is get java objects from the GWT Servlet and work with java objects. You wouldn't need to handle HTTP requests, parsing the data or json format or anything else. Your client code remains a pure java code working with java objects alone.
GWT Servlet takes care of translating java objects which are transported to client side, as http requests automatically. So, you need not bother.
Now then, to plugin into spring; yes it is like as you mentioned. For certain views(url patterns), redirect the requests in spring to gwt guy. If you look at how to implement your gwt servlet for RPC, you will know that, the servlet is configured to serve a paritular url pattern.