I've been using RequestBuilder to access REST/JSON services since GWT
version 1.7.0.  Back then, you had to extend RequestBuilder as it was
limited to POST and GET (to be compatible with Apple's then non-
compliance Safari browser).  With both GWT 2.0.3 and GWT 2.0.4, I've
been using GWT's included XHR methods (DELETE, GET, HEAD, POST and
PUT) and haven't felt the need to extend RequestBuilder just to get a
couple more methods (that I don't use) in the name of full REST
compliance.

I'm using JavaScript Overlays both for the creation and reception of
my "entity" objects.  I have to say that I'm quite pleased with this
arrangement.  Using CouchDB as a back-end, I can serve my GWT
application as a CouchApp and use the same database to serve and store
my entities (documents).  To use a JavaEE server, I load my set-up my
entities as EJB3 JPA objects, use Hibernate to get them from an RDBMS,
convert them to JSON in the web server and provide them to the front-
end in the exact same format as a document store (like CouchDB) would.

The only gotcha that I've found (and it cost me a lot of time) is with
the use of the PUT method while running GWTTestCases.  Don't bother
trying!  Every other method works, but PUT needs to be fixed (and I
haven't quite found it yet).  See
http://code.google.com/p/google-web-toolkit/issues/detail?id=4719&q=PUT%20GwtTestCase&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars
for a description of this problem.  As I was attempting to test my
modules before they were integrated, this really hampered my
integration testing.  For acceptance testing, you can load your
application up on HTMLUnit or JWebUnit and everything seems to work
fine.

You also have to be aware that JSONP is possible with GWT, but it's
really not REST.  Technically, you can only do GET methods (since the
browser thinks it retrieving a page resource) and while you can fool
it with a method override, that can be dicey.  I'd recommend only
using JSONP for retrieval of data from third-party sites (it's
tempting to use JSONP to circumvent SOP ... don't do it).

Wow ... that was a bit long-winded, but I think it's safe to say that
REST/JSON with GWT is no longer the bleeding edge.

Hope this helps, Steve Moyer

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to