GWT和Google Docs API [英] GWT and Google Docs API

查看:159
本文介绍了GWT和Google Docs API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GWT创建一个简单的应用程序,允许教师轻松创建自己的课程。



该应用程序将位于Google App Engine上,但我想要在用户的Google Docs空间中存储课程。



可以吗?



据我所知gwt将java转换为javascript,但google docs api是java,是否必须将java库上传到应用程序引擎存储?



任何地方开始?任何建议?



谢谢...

解决方案

GWT客户端的代理端。

您的GWT客户端与servlet进行通信。该servlet是使用google docs API的实际代理。



请阅读我在http://h2g2java.blessedgeek.com/2010/05/accessing-google-userservice-from-gwt.html



它解释了如何让GWT客户端与基于Java的Google API进行通信。它解释说,由于GWT要求涉及到的所有Java源都可用于GWT编译器,所以有些情况下,您根本无法让GWT客户端直接执行此任务。

a href =http://h2g2java.blessedgeek.com/2009/08/tablemgr-gae-gwt-gdata-with-rpc.html> http://h2g2java.blessedgeek.com/2009/08/tablemgr-gae -gwt-gdata-with-rpc.html 同样解释了如何使用代理方法结合gae + gwt + google文档。该发布是相当古老,因此它指向的网站不再工作了,因为我没有更新谷歌强制认证措施的gae应用程序。但是它应该可以在你的本地机器上运行。



上面提到了一个web服务器流程范例。 Google API基本上是REST API,它允许您使用JavaScript或GWT客户端直接访问它们。因此,您不必为Google API使用Java文档,而需要阅读Google REST API文档。
$ b http://code.google.com/more/ ,以及其他whatnots,提供了所有Google云API的列表。为避免使用web服务器代理流程范例,请选择API文档的JavaScript或REST版本。



以下是Google文档/数据API:
< a href =http://code.google.com/apis/gdata/docs/client-libraries.html> http://code.google.com/apis/gdata/docs/client-libraries.html 。



选择JavaScript API:
http://code.google.com/p/gdata-javascript-client/



我建议您先通过编码来练习使用这些API在JavaScript中。然后,您将很好地掌握您在GWT中需要做什么。



在访问Google REST API之前,您应该使用GWT API进行身份验证。
http://code.google.com/p/gwt-oauth2/



实际上,您正在获取经过身份验证的令牌,您的客户可以使用它来访问Google的REST API数据。

仅供参考,REST API简而言之就是定义规范中的URL,其中数据传输通常以JSON或XML为约定。


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...

解决方案

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.

这篇关于GWT和Google Docs API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆