Monday, April 14, 2008

Using Java (GWT) with Google App Engine

Since Google App Engine (GAE) announcement many developers are wondering when/if Google App Engine will support Java. As we already know GAE currently supports only Phyton.

Do Java developers have to wait for Java support in GAE? In my opinion, no.

Google App Engine can be used to host any HTML/JavaScript based application. In that scenario we still need Python, but only as a tool for application deployment.

First screencast shows exactly that:
  • Python installation (Windows).
  • GWT application deployment on GAE.

If you are not familiar with GWT you may want to take a look at the previous screencasts.

Install Python and deploy GWT app (03:10):

Certainly, GAE is much more than just a hosting platform.
GAE provides APIs for the datastore, Google Accounts, URL fetch and email services.

Problem (or opportunity?) for Java developers is that GAE API is available only for Python.

After two afternoons of Learning Python, and copying/pasting from GAE tutorials I was able to modify previous example to use GAE URL fetch API.

Here is the screencast (02:30):

Instead of conclusion:

For web application development, more work has to be done on the client-side – especially for AJAX apps. GWT does a great job in making that easier. Almost every AJAX application needs to communicate with the server and the server-side is where scalability (GAE) is needed.

This screencast shows a JSON sample, because I expect to see many approaches (frameworks) that will enable us to wrap GAE API in JSON messages.

"Any problem in computer science can be solved with another layer of indirection" [Wheeler] so I don't think that the "Python only" is an issue.

The same argument (or architecture) can be used if you are afraid of “platform lock-in”. After decades of "architectural patterns" is it really so hard to decouple client-code from GAE services?

If you liked this post, share it with others using the links below.

12 comments:

Pavan said...

Nice article.

majo said...

I invite you to look at http://code.google.com/p/python-gwt-rpc/, I write some small but usefully library.

vojko said...

Interesting! Thanks!

Vladimir said...

Great article

robin79 said...

Indeed exactly what I was looking for. I am currently planning a application for GAE and was fearing to be forced to code the UI parts in Python. As a Java developer I am feeling much more familiar with GWT.. :)

Max said...

Thanks for the video. But the most important thing is the GAE data store. Can you make a demo for adding/updating/deleting data in GAE with GWT? That will be very very helpful!!!

tv said...

Hi -

I am trying to follow your example and having some problems. I copied your demoFeed.py file and deployed my application. I am getting a "Failed to parse JSON response" error.

If I leave in the url for your blog - is this causing me a Same-Origin-Policy issue? Or should I be able to drop in any url? Any ideas would be welcome.

Thanks.

Gareth said...

PERFECT post.. thank you so much. You pulled the final missing piece together for my all-Google hosted app that include GAE and GWT.

Gareth

a Tasty Pint said...

Hey, this is great. I'd love a follow up to this. I'm trying to have my GWT app store stuff in GAE, but its confusing the hell out of me.

nAv said...

This post was excellent, but looks like Java support is native in GAE now! AND there's eclipse plugins by google. makes the whole deal much much sweeter :)

vojko said...

@nAv. It seems that new screencast should be posted. Stay tuned ;)

Seb said...

Bonjour,

Pour info, pour celles et ceux qui ne seraient pas très à l'aise avec l'anglais, j'ai mis à disposition une traduction française de la doc de Google App Engine ici:

http://www.gae-en-francais.fr

Seb.