在 Java 中为 Google AppEngine 构建 JS 服务器
我只需要为一个项目创建一个小界面。所以我决定采用给定的代码并在 Google AppEngine 上运行它。我的问题是,我在 JavaScript 方面经验丰富,并且了解了一些 Java 的基本知识,但我不知道 Java Web 应用程序是如何构建的。我启动了 Eclipse 并安装了 AppEngine-addon,下载了 Rhino 和 env.js(这对于我需要运行的一堆代码是必需的),但随后发现我坐在这些文件上,不知道将它们放在哪里。
如果有人能告诉我在哪个目录中放置 Rhino 的哪些文件,那就太好了(我假设它是“/war/WEB-INF/lib/”),如何添加 env.js-文件以及如何访问 .java 文件内的所有这些文件(应用程序的索引)。
I just needed to create a little interface for a project. So I decided to take given code and to run it on Google AppEngine. My problem is, that I'm experienced in JavaScript and got some basic knowledge of Java, but I got no clue how a Java webapp has to be structured. I started Eclipse and installed the AppEngine-addon, downloaded Rhino and env.js (which is necessary for the bunch of code I need to run) but then found me in the situation of sitting on this files not knowing where to put them.
It would be great if someone could tell me in which directory to put which files for Rhino (I assume it's "/war/WEB-INF/lib/"), how to add the env.js-file and how to access all these files inside the .java-file which is the index of the app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对应用程序引擎不太了解,但我使用 Rhino jsc 编译扩展 Servlet API 的脚本文件取得了很好的成功。最终结果是一个很好的 WAR 文件,您可以将其部署在任何 servlet 容器中,也许还可以部署在 App Engine 中。请参阅此处 有关此技术的相关博客文章,以及此处 获取示例 Eclipse项目。
I don't know about app engine in particular, but I have had good success using Rhino jsc to compile script files which extend the Servlet API. The end result is a nice WAR file which you can deploy in any servlet container, and perhaps App Engine as well. See here for my relevant blog post about this technique, and here for a sample Eclipse project.
您看过这个在 GAE 上运行 Rhino 的教程?
这是来自 官方“它会在 App Engine 中播放吗?”线程。
Have you taken a look at this tutorial on running Rhino on GAE?
It's a link from the official "Will it play in App Engine?" thread.
http://www.appenginejs.org/ 可能也会引起兴趣。
http://www.appenginejs.org/ may be of interest as well.