GWT and Google Docs API

2019-05-11 20:01发布

I'm using GWT to create a simply app that allows teachers to create easily their own lessons.

The App is going to be on Google App Engine but I want to store lessons in user's Google Docs space .

Is it possible?

As far as I know gwt transforms java into javascript but google docs api is java, do i have to upload the java library to de app engine storage?

any place to start? any advice?

Thanks...

1条回答
The star\"
2楼-- · 2019-05-11 20:45

You need server side proxy for GWT client.

Your GWT client communicates with the servlet. The servlet is the actual agent using the google docs API.

Please read my explanation at http://h2g2java.blessedgeek.com/2010/05/accessing-google-userservice-from-gwt.html.

It explains how to get a GWT client could communicate with a Java based Google API. It explains that since GWT requires all Java source involved to be available to the GWT compiler, there are cases that you simply cannot get GWT client to do the task directly.

http://h2g2java.blessedgeek.com/2009/08/tablemgr-gae-gwt-gdata-with-rpc.html similarly explains how to combine gae + gwt + google docs, using the proxy approach. The posting is quite old and therefore the web site it points to does not work anymore because I have not updated the gae app with google mandated authentication measures. But it should work on your local machine.

The above subscribes to a webserver flow paradigm.

However, Google APIs are essentially REST APIs, which allows you to access them directly using your javascript or GWT client. So, instead of using the Java docs for Google APIs, you need to read the Google REST API docs.

http://code.google.com/more/, among other whatnots, provides a list of all the Google cloud APIs. To avoid using the webserver-proxy flow paradigm, choose the javascript or REST version of the API docs.

Here is the google docs/data API: http://code.google.com/apis/gdata/docs/client-libraries.html.

Choose the javascript API: http://code.google.com/p/gdata-javascript-client/

I advise you to first practice using these APIs by coding in javascript. Then you would get a good grasp of what you need to do in GWT.

You should use the GWT API for authentication prior to accessing the Google REST APIs. http://code.google.com/p/gwt-oauth2/.

Essentially, you are obtaining an authenticated token which your client could use to access Google's data thro their REST APIs.

FYI, REST APIs are, in plain speak, URLs in a defined specification, where data transmission is by convention mostly in JSON or XML.

查看更多
登录 后发表回答