Google App Engine Java 上的 RESTful 应用程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1014034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RESTful application on Google App Engine Java?
提问by JP Richardson
I would like to create a RESTful app on Google App Engine. I would like to provide XML and JSON services. I have briefly experimented with Restlet, Resteasy, and Jersey. I haven't had much success with any of them, other than some simple examples in Restlet.
我想在 Google App Engine 上创建一个 RESTful 应用程序。我想提供 XML 和 JSON 服务。我对 Restlet、Resteasy 和 Jersey 进行了简短的试验。除了 Restlet 中的一些简单示例之外,我对其中的任何一个都没有取得太大的成功。
Could you share your experiences creating a Restful web application on Google App Engine using Java or provide any insight on the aforementioned toolkits on GAE?
您能否分享您使用 Java 在 Google App Engine 上创建 Restful Web 应用程序的经验,或者提供有关 GAE 上上述工具包的任何见解?
Thanks!
谢谢!
Edit (2009-07-25):
编辑(2009-07-25):
I have decided to use Restlet for the time being. It seems to work flawlessly so far. Please post any other insights/opinions you may have. What problems have you encountered? Have you successfully used Jersey/Restlet/Resteasy on GAE/J? If so, we want to hear about it!
我决定暂时使用Restlet。到目前为止,它似乎完美无缺。请发布您可能拥有的任何其他见解/意见。你遇到了哪些问题?你在 GAE/J 上成功使用 Jersey/Restlet/Resteasy 了吗?如果是这样,我们想听听它!
采纳答案by JP Richardson
I'm happy to report that Restlet M3 works FLAWLESSLY on AppEngine 1.2.2. I have followed the "First steps" and "First resource" tutorials found http://restlet.com/technical-resources/restlet-framework/guide.
我很高兴地报告 Restlet M3 在 AppEngine 1.2.2 上完美运行。我遵循了http://restlet.com/technical-resources/restlet-framework/guide 中的“第一步”和“第一资源”教程。
So, it seems to me that Restlet is the answer for your GAE/J Restful applications.
因此,在我看来,Restlet 是您 GAE/J Restful 应用程序的答案。
回答by Niklas
The 2 most cumbersome GAE REST API actions to make work, whether Java or .py, are graphics and how to undisplay private information. My littlegae rest feed forked anotherproject. I'm sure Java succeeds where python stuck due to the Java takes and gives more ways (advantages) as well as longer (slower) time to succeed (disadvantage) while python projects opens less ways to succeed (disadvantageous) and less development time (advantageous rapid development) to succeed the same.
2 个最麻烦的 GAE REST API 操作,无论是 Java 还是 .py,都是图形以及如何取消显示私人信息。我的小gae 休息提要分叉了另一个项目。我确信 Java 会在 Python 卡住的地方取得成功,因为 Java 需要并提供更多方法(优势)以及更长(更慢)的成功时间(劣势),而 Python 项目开辟的成功方法更少(劣势)和更少的开发时间(优势快速发展)成功相同。
回答by StaxMan
For what it's worth, there has been quite a bit of discussion on Jersey user listswrt how to make Jersey work on GAE. It is bit tedious work due to GAE restrictions (missing classes from white lists -- hopefully resolved over time), but apparently can be made to work. So while not trivially easy, that might be your best bet; esp. since many of the problems faced are the same for all frameworks (imposed by GAE).
对于它的价值,在Jersey 用户列表上已经有很多关于如何使 Jersey 在 GAE 上工作的讨论。由于 GAE 限制(白名单中缺少类 - 希望随着时间的推移解决),这有点乏味的工作,但显然可以工作。因此,虽然并非易事,但这可能是您最好的选择;特别是 因为所有框架面临的许多问题都是相同的(由 GAE 强加)。
回答by broschb
I am going to begin exploring this as well, but haven't started yet. I did find this framework, that says it should work, but like I said haven't tried it yet.
我也打算开始探索这个,但还没有开始。我确实找到了这个框架,它说它应该可以工作,但就像我说的那样还没有尝试过。
http://wiki.restlet.org/docs_1.2/13-restlet/275-restlet/252-restlet.html
http://wiki.restlet.org/docs_1.2/13-restlet/275-restlet/252-restlet.html
If you get it working, or manage to get one of the above suggestions working, update everyone as I am sure there is interest in this.
如果您让它工作,或设法使上述建议之一起作用,请更新每个人,因为我确信有人对此感兴趣。
回答by Harald
I'm using Restlet together with Guice on Google AppEngine. IMHO they fit together very well. See my recent blog post for further details: http://haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html
我在 Google AppEngine 上将 Restlet 与 Guice 一起使用。恕我直言,他们非常适合在一起。有关更多详细信息,请参阅我最近的博客文章:http: //haraldpehl.blogspot.com/2009/11/google-appengine-restlet.html
回答by Viren
I'm using Jersey on GAE. Here is the link for those who are interested about setting it up: (I'm using GAE SDK v1.4.0):
我在 GAE 上使用 Jersey。这是那些对设置感兴趣的人的链接:(我使用的是 GAE SDK v1.4.0):
http://tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html
http://tugdualgrall.blogspot.com/2010/02/create-and-deploy-jax-rs-rest-service.html
回答by opensas
Well, I would highly advice you to have a look at play framework
好吧,我强烈建议你看看play 框架
Have a look at the video on the homepage
看看主页上的视频
It has a gae module
它有一个gae 模块
With sienaas a orm to handle gae datastore
以siena作为 orm 来处理 gae 数据存储
From all the java frameworks I've seen so far, I think it has the easier learning curve,
从我目前看到的所有 Java 框架来看,我认为它的学习曲线更容易,
great documentation,
a tutorialto develop a complete application
very active and helpfull community,
free as in beer and also as in speech
highly scalable due to it's stateless out of the box design
highly customizable via it's modules and plugin approach
more over, taking into account it's for a college course, it's really easy to hack into the code, I could handle a couple of tickets and new features without any experience at all with java, just a couple of year developing web applications with php
此外,考虑到它是一门大学课程,它真的很容易破解代码,我可以在没有任何 Java 经验的情况下处理几张票和新功能,只需一年时间用 php 开发 Web 应用程序
other benefits
其他福利
it's really easy to start, no complicated setup involved, just download and unzip the file and your are ready
great development experience, just fix the code and hit refresh, play autocompiles changes on the fly when running on development mode
fast and lightweight
fullstack, you don't have to integrate cumbersome frameworks to make it work
great errors report, no more endless error stack trace, just shows you the line with error
no xml configuration anywhere around
great support for tdd with selenium integrated test
它真的很容易开始,不涉及复杂的设置,只需下载并解压缩文件即可
很棒的开发体验,只需修复代码并点击刷新,在开发模式下运行时即时播放自动编译更改
快速轻便
fullstack,您不必集成繁琐的框架即可使其工作
很棒的错误报告,没有更多的无休止的错误堆栈跟踪,只显示有错误的行
周围没有 xml 配置
对带有硒集成测试的 tdd 的大力支持
I think the main advantage as a learning tool, is that it's possible to peek into the source code without feeling lost and the community support... The documentation is very clear, and you can learn a lot by just having a look at the source code...
我认为作为学习工具的主要优点是可以偷看源代码而不会感到迷失和社区支持...文档非常清晰,只需查看源代码就可以学到很多东西代码...
回答by Nacho Coloma
I recently put together a project template with Jersey, Guice and AppEngineat GitHub. It has been developed with SimpleDS, but it can be modified to work with Objectify / JDO easily. The project is live here.
我最近在 GitHub 上与Jersey、Guice 和 AppEngine一起制作了一个项目模板。它是使用 SimpleDS 开发的,但可以对其进行修改以轻松使用 Objectify / JDO。该项目是住在这里。
It should be a good starting point for new projects.
它应该是新项目的一个很好的起点。
回答by Tyvain
Here is a very very good tutorial Restlet/Android/GAE/Objectify with an example of a simple application. Sorry it's in french, but you can juste copy/paste the code, or use google traduction.
这是一个非常非常好的教程 Restlet/Android/GAE/Objectify 带有一个简单应用程序的示例。对不起,它是法语,但您可以复制/粘贴代码,或使用谷歌翻译。
I followed it and had a working Android / GAE server communicating together in a 2 hours. It's a good base to start or test Restlet.
我遵循了它,并在 2 小时内让一个可以正常工作的 Android/GAE 服务器一起通信。这是启动或测试 Restlet 的良好基础。
http://www.tutos-android.com/webservice-rest-android-appengine-restlet-objectify
http://www.tutos-android.com/webservice-rest-android-appengine-restlet-objectify
Good Luck
祝你好运
回答by Carl
Since these valiant older solutions were patched together, Google has apparently supplied an Eclipse plugin to create a starter project that produces an App Engine app, an Android APK, and a Web app, all talking to one another over an interface defined by a single set of annotated object declarations.
由于这些勇敢的旧解决方案被拼凑在一起,谷歌显然提供了一个 Eclipse 插件来创建一个启动项目,该项目生成一个 App Engine 应用程序、一个 Android APK 和一个 Web 应用程序,所有这些都通过由一组定义的接口相互交谈带注释的对象声明。
Haven't tried this yet myself, but do have a look before trying any of the more heterogeneous examples described in the earlier messages above:
我自己还没有尝试过这个,但在尝试上面早期消息中描述的任何更异构的示例之前,请先看看:
https://developers.google.com/eclipse/docs/appengine_connected_android
https://developers.google.com/eclipse/docs/appengine_connected_android
This Google video is also quite informative:
这个谷歌视频也非常有用: